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

Skapa ett konto eller logga in för att kommentera

Du måste vara medlem för att kunna kommentera

Skapa ett konto

Det är enkelt att registrera ett nytt konto

Bli medlem

Logga in

Har du redan ett konto? Logga in här

Logga in