polynomial-interpolation.tex 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{pgfplots}
  3. \usepackage{tikz}
  4. \begin{document}
  5. \begin{tikzpicture}
  6. \begin{axis}[
  7. %legend pos=south east,
  8. axis x line=none,
  9. axis y line=none,
  10. %grid = major,
  11. width=8cm,
  12. height=12cm,
  13. %grid style={dashed, gray!30},
  14. xmin=-90, % start the diagram at this x-coordinate
  15. xmax= 30, % end the diagram at this x-coordinate
  16. ymin=-36, % start the diagram at this y-coordinate
  17. ymax= 57, % end the diagram at this y-coordinate
  18. %axis background/.style={fill=white},
  19. xlabel=x,
  20. ylabel=y,
  21. %xticklabels={-2,-1.6,...,2},
  22. %yticklabels={-8,-7,...,8},
  23. %tick align=outside,
  24. enlargelimits=true,
  25. tension=0.08]
  26. \addplot[domain=-90:30, black, thick,samples=500] {-30.550224302876202 +1.3405464324655687*x +0.33940746902954505*x*x +0.006043447628845429*x*x*x -0.00040762779516188906*x*x*x*x -0.000016598804950050045*x*x*x*x*x -2.1597800840011248e-7*x*x*x*x*x*x +-9.533599505095986e-10*x*x*x*x*x*x*x};
  27. %\addplot[domain=-90:30, red, thick,samples=500] {-107/168000000*x^5 -5053/50400000*x^4 -103/28800*x^3 +1237/20160*x^2 +59573/25200*x +-77/15};
  28. \addplot[red, only marks, mark=*] coordinates {(-79.66666666666667,9.333333333333329) (-69.33333333333333,19.33333333333333) (-58.333333333333336, 19.66666666666667) (-39.666666666666664,0) (-29.666666666666664,8.333333333333329) (-9,-21.33333333333333) (10.333333333333329,19.33333333333333) (22,19.66666666666667)};
  29. %\addlegendentry{$f(x)=x^3$}
  30. \end{axis}
  31. \end{tikzpicture}
  32. \end{document}