Reputation: 1
How do you plot a Bessel function (2d) of the 1st kind in Matlab?
Upvotes: 0
Views: 7990
Reputation: 8864
If you mean a 2d plot, you could choose a few \nu and overlay, using, e.g.
nu=0:0.5:3;
[nuGrid,z]=meshgrid(nu,linspace(0,10,100));
myBessel=besselj(nuGrid,z);
plot(z,myBessel)
xlabel('\nu')
ylabel('z')
zlabel('J_\nu(z)')
legend(cellstr(num2str(nu')))
which gives:
If you mean a plot of the function of two variables, here is a way (you can replace mesh
with surf
if you want) :
[nu,z]=meshgrid(linspace(0,5,100),linspace(0,10,100));
myBessel=besselj(nu,z);
mesh(nu,z,myBessel)
xlabel('\nu')
ylabel('z')
zlabel('J_\nu(z)')
Here is the resulting plot:
Upvotes: 1
Reputation: 308938
Two parts to this:
Upvotes: 1