在Matlab中绘制特殊函数(2D Bessel)

时间:2010-05-07 08:45:59

标签: matlab

我试图从本质上得到这样的东西,我可以在底部看到清晰的涟漪但是它就像一个高斯: alt text

这种情况并不令人满意,因为涟漪不是很明显,它有一种非常坚韧的质量,可以使图像稍微模糊,如果你移动图形使它只是2D(所以它看起来像一个圆圈)我甚至不确定它是否应该如此(同心圆似乎在真实的东西中更均匀地间隔)。那么,有更好的方法吗?

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;

2 个答案:

答案 0 :(得分:1)

您需要更改色彩图,或更改表面属性并使用反射显示形状。看看documentation,看看你能做的一切。例如:

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');

答案 1 :(得分:1)

这是你想要的吗?

冲浪

alt text

代码

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)