With Mathematica I found formula of the curve is 6.12465 - 0.206646 x - 4.42686 x^2 - 2.58476 x^3 + 3.53276 x^4 + 3.78595 x^5 - 2.30475 x^6 - 1.91715 x^7 + 1.0322 x^8 + 0.430597 x^9 - 0.286308 x^10 - 0.0251744 x^11 + 0.040756 x^12 - 0.00530342 x^13 - 0.00183667 x^14 + 0.000649826 x^15 - 0.0000757694 x^16 + 3.16808*10^-6 x^17
I reduce the code and draw in pgfplots
. I tried
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepackage{fouriernc}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
declare function={Y(\x)=6-0.21*\x -4.43*\x^2 -2.6*\x^3 +3.5*\x^4 +3.8*\x^5 -2.31*\x^6 -1.2*\x^7 +1.03*\x^8 +0.43*\x^9 -0.29*\x^10 -0.03*\x^11 +0.04*\x^12 -0.005*\x^13 -0.001*\x^14 +0.001*\x^15 + 3.169*10^{-6}*\x^17;},
axis lines = center,
xlabel=$x$,ylabel=$y$,
domain=-2.5:4.5,
ymin=-4,
ymax=6.2,
xmin=-3,
xmax=4.2,
samples=100,xtick distance=1,
ytick distance=2,unit vector ratio*=1 1 1,
width=11cm,
grid=major,
grid style={gray!30}
]
\addplot [black, thick] {Y(x)};
\addplot [black, mark=*,only marks,samples at={0,-1,1,-2,2}] {Y(x)};
\node at (axis cs:-0.25, -0.25) {$O$} ;
\end{axis}
\end{tikzpicture}
\end{document}
But I don't get the result. How can I draw it in pgfplots
or tikz
?