www.pudn.com > levelsetImage.rar > lsexample.m


% LSEXAMPLE example of a level set
% Draw a parabaloid intersecting a plane.

x = linspace( -2 * pi, 2 * pi, 25 );
y = x;
[ X, Y ] = meshgrid( x, y );
Z_paraboloid = X.^2 + Y.^2;
Z_plane = repmat( 25, size( X ) );
figure( 1 );
grid off;
axis off;
hold on;

surf( X, Y, Z_paraboloid );
surf( X, Y, Z_plane );

t = linspace( 0, 2 * pi, 100 );
z = repmat( 25, [1,100] );
for i = 24:0.05:26;
  plot3( sqrt(i) * cos( t ), sqrt(i) * sin( t ), z, 'k-' );
end;

hold off;