Reputation: 65
I am trying to make a plot like this:-
I can use this formula to plot it : NearField = r^2/l
where r = the radius of the transducer
and l = the ultrasound wavelength
Here is my code :
colormap(hsv);
l=0.0001:0.00015:0.0015;
r=0.001:0.001:0.01;
[x,y]=meshgrid(r,l);
nearField = x.^2/y;
mesh(r,l,nearField)
When I plot it, I get the following :
Why do I not get the plot like in first figure?
Upvotes: 1
Views: 117
Reputation: 5
I think you should not use mesh in the bottom line. Plot3 or surf commands should do want you want (the first one draws lines, the second one draws a surface). I hope it was helpful.
Upvotes: 0
Reputation: 21
You used the wrong coordinates. The first seems to use polar coordinates instead of x,y. Also your r is called radius, which means that r²=x²+y². You have to transform the formular in x,y coordinates to use mesh. I don't think, that there is a matlab function which does this automatically :/
Upvotes: 2