0001 function isobars
0002
0003
0004
0005 clear; close all;
0006
0007 s = 40;
0008 w = 1/150;
0009 cvec = 10:60:300;
0010
0011 p = -s:s;
0012 [x,y] = meshgrid(p);
0013 f = exp(-w*(x.^2 + y.^2));
0014 f = max(f,0);
0015 f = sqrt(f);
0016
0017 surf(x,y,f); shading interp; hold on; rotate3D
0018
0019 V = (x + 10).^2 + (y + 10).^2 + f.^2;
0020
0021 for k = 1:length(cvec)
0022 c = cvec(k);
0023 Vc = (V > c);
0024
0025
0026
0027 se = [0 1 0 ; 1 1 1 ; 0 1 0];
0028
0029 Vcdil = conv2(Vc,se,'same');
0030 Vcdil = Vcdil > 0;
0031
0032 Vc = Vcdil - Vc;
0033 Vcvec = find(Vc);
0034
0035 plot3(x(Vcvec),y(Vcvec),f(Vcvec),'w.')
0036
0037 end
0038
0039 hold off