Graphing special functions in Matlab (2D Bessel)
Posted
by favala
on Stack Overflow
See other posts from Stack Overflow
or by favala
Published on 2010-05-07T08:45:59Z
Indexed on
2010/05/07
12:18 UTC
Read the original article
Hit count: 172
matlab
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:
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;
© Stack Overflow or respective owner