tags:

views:

88

answers:

2

I'm trying to essentially get something like this where I can see clear ripples at the base but otherwise it's like a Gaussian: alt text

This is kind of unsatisfactory because the ripples aren't very noticeable, it has a very gritty quality that obscures the image a bit, and if you move the graph so that it's just in 2D (so it looks like a circle) I'm not even sure if it's quite like how it should be (the concentric circles seem to be more evenly spaced in the real thing). So, is there a better way to do this?

a = 2*pi;
[X Y] = meshgrid(-1:0.01:1,-1:0.01:1);
R = sqrt(X.^2+Y.^2);
f = (2*besselj(1,a*R(:))./R(:)).^2;
mesh(X,Y,reshape(f,size(X)));
axis vis3d;
+1  A: 

You need to change the colormap, or change the surface properties and show shape with reflections. Have a look at the documentation to see all you can do. For example:

a = 2*pi;
[X Y] = meshgrid(-1:0.01:1,-1:0.01:1);
R = sqrt(X.^2+Y.^2);
f = (2*besselj(1,a*R(:))./R(:)).^2;
h=mesh(X,Y,reshape(f,size(X)));
axis vis3d;
%# change from mesh to solid surface with no lines
set(h,'FaceColor','interp','edgeColor','none','facelighting','phong');
%# set reflectance
material shiny
%# add light. Change the position to see different reflections
light('Position',[10 0 10],'Style','local');
Jonas
+1  A: 

Is this what you want?

Surf

alt text

Code

a = 2*pi;
[X Y] = meshgrid(-1:0.1:1,-1:0.1:1);
R = sqrt(X.^2+Y.^2);
f = (2*besselj(1,a*R(:))./R(:)).^2;
h=surf(X,Y,reshape(f,size(X)));
axis vis3d;
set(h,'FaceAlpha',0)
Jacob

related questions