|
From: | Doug Stewart |
Subject: | Re: 3d Plot |
Date: | Fri, 10 Jul 2015 21:19:19 -0400 |
I have a plotting problem and found a related example in the distribution of gnuplot. However, I can not produce the plot with octave. How do I do this?
############################################################
function [p]=x(u,v)
p=2 * (cos(u)+u .* sin(u)) .* sin(v) ./ (1+u .^ 2 .* (sin(v)) .^ 2);
endfunction;
function [p]=y(u,v)
p=2 * (sin(u)-u .* cos(u)) .* sin(v) ./ (1+u .^ 2 .* (sin(v)) .^ 2);
endfunction;
function [p]=z(u,v)
p=log(tan(v/2.)) + 2 * 1 .^ cos(v) ./ (1+u .^ 2 .* (sin(v)) .^ 2);
endfunction;
u=[-4.5:9/99:4.5]; v=[0.05:(pi-0.10)/99:pi-0.05];
X=x(u,v);
Y=y(u,v);
[xx,yy]=meshgrid(u,v);
Z=z(xx,yy);
mesh(X,Y,real(Z));
meshz(X,Y,real(Z));
#####################################################################
The gnuplot demo is
set label 1 "Kuen's Surface" at screen 0.57, 0.9
set label 1 font "frscript,20"
set pm3d depthorder border linetype -1 linewidth 0.5
set style fill transparent solid 0.65 border
set palette
set hidden3d
set ticslevel 0
unset xtics ; unset ytics ; unset ztics
unset border ; unset colorbox ; unset key
set lmargin at screen 0.1
set bmargin at screen 0.1
set rmargin at screen 0.9
set tmargin at screen 0.9
set parametric
set dummy u,v
set urange [-4.5:4.5]
set vrange [0.05:pi-0.05]
set isosamples 51,51
set view 122, 357, 1.35, 1.08
a = 1.0
x(u,v) = 2.*a*(cos(u)+u*sin(u))*sin(v) / (1+u**2.*(sin(v))**2)
y(u,v) = 2.*a*(sin(u)-u*cos(u))*sin(v) / (1+u**2.*(sin(v))**2)
z(u,v) = a*log(tan(v/2.))+2.*cos(v)/(1+u**2.*(sin(v))**2)
splot x(u,v), y(u,v), z(u,v) with pm3d
Tom Dean
_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave
[Prev in Thread] | Current Thread | [Next in Thread] |