# HG changeset patch # User Rik # Date 1380141969 25200 # Node ID 89ffc9c786e5f0446e2b1ab108ec3f060254f9cb # Parent ff5ff67946cb18e32e9e06d050c2b3b9b9d4c8ef sombrero.m: Return meshgridded x,y rather than vectors. * scripts/plot/sombrero.m: Return meshgridded x,y rather than vectors so that behavior is the same as peaks(). diff -r ff5ff67946cb -r 89ffc9c786e5 scripts/plot/sombrero.m --- a/scripts/plot/sombrero.m Wed Sep 25 13:44:24 2013 -0700 +++ b/scripts/plot/sombrero.m Wed Sep 25 13:46:09 2013 -0700 @@ -57,20 +57,18 @@ error ("sombrero: number of grid lines N must be greater than 1"); endif - tx = linspace (-8, 8, n)'; - ty = tx; - [xx, yy] = meshgrid (tx, ty); - r = sqrt (xx .^ 2 + yy .^ 2) + eps; # eps prevents div/0 errors - tz = sin (r) ./ r; + [xx, yy] = meshgrid (linspace (-8, 8, n)); + r = sqrt (xx.^2 + yy.^2) + eps; # eps prevents div/0 errors + zz = sin (r) ./ r; if (nargout == 0) - surf (tx, ty, tz); + surf (xx, yy, zz); elseif (nargout == 1) - x = tz; + x = zz; else - x = tx; - y = ty; - z = tz; + x = xx; + y = yy; + z = zz; endif endfunction