\documentclass[border=2pt,tikz]{standalone}
\usepackage{tkz-euclide}
\tikzset{%
every picture/.style={%
samples=300,%
smooth,%
line join=round,%
font=\small,%
thick,>={Stealth[]}%
}%
}%
\begin{document}
\begin{tikzpicture}
\draw[->] (-2.5,0) -- (3,0) node[below] {$x$};
\draw[->] (0,-2) -- (0,2) node[right] {$y$};
\coordinate[label=-45:$O$] (O);
\tkzDefPoints{-2.39/0.27/A,-2/0/B,-1.15/-0.73/C,-0.55/0/D,-0.21/0.51/E,0/0/F,0.21/0.51/G,0.55/0/H,1.15/-0.73/I,2/0/J,2.39/0.27/K}
\draw plot[smooth,tension=.7] coordinates{(A)(B)(C)(D)(E)(F)(G)(H)(I)(J)(K)};
\end{tikzpicture}
\end{document}
如果要取点,增加取点的数量/缩小取点的间隙是不是就可以解决「图象光滑度不是很满意」的问题呢?
related:
\tkzDefPoints{-2.39/0.27/A,-2/0/B,-1.15/-0.73/C,-0.55/0/D,-0.21/0.51/E,0/0/F,0.21/0.51/G,0.55/0/H,1.15/-0.73/I,2/0/J,2.39/0.27/K}
\draw plot[smooth,tension=.7] coordinates{(A)(B)(C)(D)(E)(F)(G)(H)(I)(J)(K)};
的丑陋语法让我难以接受...所以我 不打算用取点法 。
Learning From this link:
\documentclass[border=5pt,tikz]{standalone}
\tikzset{line join=round,line cap=round,thick}%
\newcommand*\myhalfpath[1][black]{%
\draw[#1] (0,0)
.. controls (.1,1) and (.6,1) .. (.8,0)
.. controls (1.2,-1.75) and (1.6,-1.2) .. (2.8,0)
.. controls (2.9,.1) and (3.1,.18) .. (3.2,.2)
;
}
\begin{document}
\begin{tikzpicture}
\draw[-latex] (-3.25,0) -- (3.25,0) node[below] {$x$};
\draw[-latex] (0,-2) -- (0,2) node[right] {$y$};
\begin{scope}[xscale=-1]
\myhalfpath[magenta]
\end{scope}
\myhalfpath[magenta]
\end{tikzpicture}
\begin{tikzpicture}
\draw[-latex] (-3.25,0) -- (3.25,0) node[below] {$x$};
\draw[-latex] (0,-2) -- (0,2) node[right] {$y$};
\myhalfpath[cyan]
\begin{scope}[scale=-1]
\myhalfpath[cyan]
\end{scope}
\end{tikzpicture}
\end{document}
如果还是不光滑就自己微调吧....
And, 希望OP可以从上面的这些提问中总结一套「此类函数绘制题」各个思路的对比和局限性的介绍,不然经常需要重复提问类似的问题。
谢谢!如果能猜到A项是哪个函数自然是最佳的,但我没有猜到那个函数是什么
我试试增加点的个数看看
@u1680 请注意区分「回答」和「评论」,不要给本页面增加重复信息。
请删除下面的「回答」
我猜了一个...
但是你图中的「A」和「B」并不是关于x轴对称...
我猜 这不是出题人刻意为之,因为本题考察点没必要卡在判断零点个数, 似乎 完全是因为画图者的粗心,导致A和B不是简单的镜像关系...
@u70550 厉害!谢谢,我没有找到删除回答按键,之前就想删除了的。
@u70550 命题人的想法可能和解题人不一样,通常命制这类题目多数人对选项D关于(0,0)对称,翻折一下得到4个选项,而不是这里选项中各种乱画。
@u1680
支持
@u70550
我试了函数f(x)=(9x^2*cosx-0.1x^3)/e^{abs{x}}和A项类似,靠近y轴处不没有那么陡