[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: help with gnuplot

**From**: |
John Eaton |

**Subject**: |
Re: help with gnuplot |

**Date**: |
Mon, 26 Jun 95 00:52:36 EDT |

address@hidden (Shu-Kit Yeung) wrote:
: I am seeking help for using octave to make "movies" for sequence of
: plots like MATLAB can. I will be thankful if any one can give the
: information. Thank you for your attention!!
The following example should sort of work, at least on an X display
and a fast machine. It doesn't actually generate a movie (like an
MPEG file), it just displays a series of plots. (I would certainly
welcome changes for generating MPEG files if someone wants to do the
work.)
Thanks,
jwe
-------------------------------hat_movie.m-------------------------------
function hat_movie (nlines, nframes)
# usage: hat_movie (nlines, nframes)
#
# Draw a series of `sombreros' in three dimensions using `nlines' grid
# lines. The function plotted is
#
# z = k * sin (x^2 + y^2) / (x^2 + y^2);
#
# where k varies between 0 and 1.
if (nargin == 0)
nlines = 31;
nframes = 7;
elseif (nargin == 1)
nframes = 7;
elseif (nargin > 2)
error ("usage: hat_movie (nlines, nframes)");
endif
set zrange [-0.6:1.1]
for i = 1:nframes
if (nframes > 1)
k = (i-1)/(nframes-1);
else
k = 1;
endif
x = y = linspace (-8, 8, nlines)';
[xx, yy] = meshdom (x, y);
r = sqrt (xx .^ 2 + yy .^ 2) + eps;
z = k * sin (r) ./ r;
mesh (x, y, z);
endfor
endfunction