Functions | |
if (nargin!=6 &&nargin!=7) print_usage() | |
if (nargin==6) n | |
if (nargout > 0) xx | |
else | surf (h, x, y, z) |
endif endfunction!demo | !ellipsoid (0, 0, 1, 2, 3, 4, 20) |
Variables | |
function [xx, yy, zz] | |
endif | xc = varargin{1} |
yc = varargin{2} | |
zc = varargin{3} | |
xr = varargin{4} | |
yr = varargin{5} | |
zr = varargin{6} | |
else | n = varargin{7} |
endif | theta = linspace (0, 2 * pi, n + 1) |
phi = linspace (-pi / 2, pi / 2, n + 1) | |
x = meshgrid (theta, phi) xr .* cos (phi) .* cos (theta) + xc | |
y = yr .* cos (phi) .* sin (theta) + yc | |
z = zr .* sin (phi) + zc | |
yy = y | |
zz = z |
endif endfunction !demo !ellipsoid | ( | 0 | , | |
0 | , | |||
1 | , | |||
2 | , | |||
3 | , | |||
4 | , | |||
20 | ||||
) |
if | ( | nargout | , | |
0 | ||||
) |
if | ( | nargin | = =6 |
) |
if | ( | nargin! | = 6 &&nargin!=7 |
) |
else surf | ( | h | , | |
x | , | |||
y | , | |||
z | ||||
) |
function[xx, yy, zz] |
else n = varargin{7} |
xr = varargin{4} |
yc = varargin{2} |
yr = varargin{5} |
yy = y |
zc = varargin{3} |
zr = varargin{6} |
zz = z |