gnuplot / parametric (E)
not so FAQ |
About Parametric Functionsuse of parameters In the usual 2-dimensional plot of gnuplot, the Y coordinate is x = f(t) y = g(t) With this expression, more complicated functions can be plotted with First of all, you need to use the command set parametric to draw a vertical line The most simple but it is impossible to express by the y=f(x) form x=const y=t with the parameter t, when t is varied. The range of gnuplot> set parametric dummy variable is t for curves, u/v for surfaces gnuplot> const=3 gnuplot> set trange [1:4] gnuplot> set xrange [0:5] gnuplot> set yrange [0:5] gnuplot> plot const,t In this case the vertical line is draw at x=3. Since we used set to draw a circle, polygonsThe parametric expression of a circle is x=sin(t) y=cos(t) and the circle can be drawn if one changes the t parameter gnuplot> set parametric dummy variable is t for curves, u/v for surfaces gnuplot> set size square gnuplot> set xrange [-1:1] gnuplot> set yrange [-1:1] gnuplot> plot [0:2*pi] sin(t),cos(t) ![]() The parameter t is not changing continuously, and actually ![]() The 2-dim. parametric representation is convenient to draw a x=r(t)*cos(t) y=r(t)*sin(t) The circle is a special case of which r(t)=const. When the radius of gnuplot> set xrange [-10*pi:10*pi] gnuplot> set yrange [-10*pi:10*pi] gnuplot> plot [0:10*pi] t*sin(t),t*cos(t) ![]() The following example shows r(t)=const*(1+cos(t)), which is called gnuplot> set parametric dummy variable is t for curves, u/v for surfaces gnuplot> r(t) = 1+cos(t) gnuplot> plot [0:2*pi] r(t)*cos(t),r(t)*sin(t) ![]() exchange X and Y-axes Functions are normaly expressed by y=f(x), but the parametric gnuplot> set parametric dummy variable is t for curves, u/v for surfaces gnuplot> c=2*pi gnuplot> set size square gnuplot> set trange [-c:c] gnuplot> set xrange [-c:c] gnuplot> set yrange [-c:c] gnuplot> plot c*sin(t),t with lines, t,c*cos(t) with impulses Two functions are shown, one (green stripe) is y=2pi*cos(x), and the other The option with impulse draws a vertical line from the |