gnuplot / spherical_harmonics / parametric (E)
Parametric Expression There are two ways to display a 3-dimensional function. The x = f(u,v) y = g(u,v) z = h(u,v) When your function f(x,y) is not so complicated, the former method gnuplot> f(x,y)=sin(x)*cos(y) gnuplot> splot f(x,y) However a function defined in the polar coordinate is hard to The sphere can be expressed with two parameters u and With the angles u,v and radius r, an arbitrary x = r*cos(u)*cos(v) y = r*sin(u)*cos(v) z = r*sin(v) The sphere can be defined in the polar coordinate so as that x = cos(u)*cos(v) y = sin(u)*cos(v) z = sin(v) Therefore to draw a 3-D sphere with gnuplot: gnuplot> set parametric dummy variable is t for curves, u/v for surfaces gnuplot> set angle degree gnuplot> set urange [0:360] gnuplot> set vrange [-90:90] gnuplot> set isosample 72,36 gnuplot> set ticslevel 0 gnuplot> set size 0.7,1.0 gnuplot> a=1 gnuplot> splot a*cos(u)*cos(v),a*sin(u)*cos(v),a*sin(v) The default angle unit is radian. The second line set angle The roughness of wire-frame can be controlled by set isosample The functions used above can be more in a convenient form when one gnuplot> fx(u,v)=cos(u)*cos(v) gnuplot> fy(u,v)=sin(u)*cos(v) gnuplot> fz(v)=sin(v) gnuplot> splot a*fx(u,v),a*fy(u,v),a*fz(v) |