Vinnaren i pepparkakshustävlingen!
2008-06-14, 02:36
  #1
Medlem
debians avatar
Hur ska jag göra för att plotta den här kurvan (y^2 = x^3 − 4x + 4) med gnuplot?

http://static.pici.se/pictures/EfwMBNIzi.png
Citera
2008-06-14, 11:36
  #2
Medlem
Citat:
Ursprungligen postat av debian
Hur ska jag göra för att plotta den här kurvan (y^2 = x^3 − 4x + 4) med gnuplot?

http://static.pici.se/pictures/EfwMBNIzi.png


"3.8 How do I plot implicit defined graphs?

Implicit graphs or curves cannot be plotted directly in gnuplot. However there is a workaround.

gnuplot> # An example. Place your definition in the following line:
gnuplot> f(x,y) = y - x**2 / tan(y)
gnuplot> set contour base
gnuplot> set cntrparam levels discrete 0.0
gnuplot> unset surface
gnuplot> set table 'curve.dat'
gnuplot> splot f(x,y)
gnuplot> unset table
gnuplot> plot 'curve.dat' w l

The trick is to draw the single contour line z=0 of the surface z=f(x,y), and store the resulting contour curve to a gnuplot datafile."
http://www.gnuplot.info/faq/faq.html...00000000000000

Så det går inte direkt, utan du får 'fusk' använda 3D för det. Alternativt får du plotta y^2 = x^3 - 4x + 4 på så vis att det är y = sqrt(x^3 - 4x + 4) om x^3 - 4x + 4 > 0 och y = -sqrt(x^3 - 4x + 4) om x^3 - 4x + 4 < 0.
Citera

Stöd Flashback

Flashback finansieras genom donationer från våra medlemmar och besökare. Det är med hjälp av dig vi kan fortsätta erbjuda en fri samhällsdebatt. Tack för ditt stöd!

Stöd Flashback