1## Copyright (C) 1998-2003 Joao Cardoso.
2##
3## This program is free software; you can redistribute it and/or modify it
4## under the terms of the GNU General Public License as published by the
5## Free Software Foundation; either version 2 of the License, or (at your
6## option) any later version.
7##
8## This program is distributed in the hope that it will be useful, but
9## WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11## General Public License for more details.
12##
13## This file is part of plplot_octave.
14
15function p9
16
17  global pl_automatic_replot
18  t = pl_automatic_replot;
19  pl_automatic_replot = 0;
20
21  as = autostyle;
22  autostyle ("off");
23
24  ls = legend;
25  legend "off"
26
27  step = 0.2;
28  x = -2:step:2;
29  y = -2:step:2;
30  [xx,yy] = meshgrid(x,y);
31  z = xx .* exp(-xx.^2 - yy.^2);
32  [gy, gx] = gradn(z,step,step);
33  title("Vector field example");
34  contour(x,y,z)
35  hold on;
36  arrows(yy,xx,gx./2,gy./2);
37  hold off
38  plflush;
39
40  legend(ls);
41  autostyle(as);
42  pl_automatic_replot = t;
43
44endfunction
45