Mercurial > hg > octave-nkf
annotate scripts/plot/sombrero.m @ 4:b4df021f796c
[project @ 1993-08-08 01:26:08 by jwe]
Initial revision
author | jwe |
---|---|
date | Sun, 08 Aug 1993 01:26:08 +0000 |
parents | |
children | 16a24e76d6e0 |
rev | line source |
---|---|
4 | 1 function sombrero (n) |
2 | |
3 # usage: sombrero (n) | |
4 # | |
5 # Draw a `sombrero' in three dimensions using n grid lines. The | |
6 # function plotted is | |
7 # | |
8 # z = sin (x^2 + y^2) / (x^2 + y^2); | |
9 | |
10 if (nargin != 1) | |
11 error ("usage: sombrero (n)"); | |
12 endif | |
13 | |
14 x = y = linspace (-8, 8, n)'; | |
15 [xx, yy] = meshdom (x, y); | |
16 r = sqrt (xx .^ 2 + yy .^ 2) + eps; | |
17 z = sin (r) ./ r; | |
18 | |
19 mesh (x, y, z); | |
20 | |
21 endfunction |