Mercurial > hg > octave-lyh
view scripts/plot/sombrero.m @ 78:0fda6e1f90e0
[project @ 1993-08-30 15:40:16 by jwe]
author | jwe |
---|---|
date | Mon, 30 Aug 1993 15:40:48 +0000 |
parents | b4df021f796c |
children | 16a24e76d6e0 |
line wrap: on
line source
function sombrero (n) # usage: sombrero (n) # # Draw a `sombrero' in three dimensions using n grid lines. The # function plotted is # # z = sin (x^2 + y^2) / (x^2 + y^2); if (nargin != 1) error ("usage: sombrero (n)"); endif x = y = linspace (-8, 8, n)'; [xx, yy] = meshdom (x, y); r = sqrt (xx .^ 2 + yy .^ 2) + eps; z = sin (r) ./ r; mesh (x, y, z); endfunction