3D axis rotation with meshgrid

3 views (last 30 days)
Laura Mugica
Laura Mugica on 17 Sep 2018
Commented: Laura Mugica on 20 Sep 2018
Hello, I would like to rotate B around the z axis and plot the contour plot. I tried the following but I don't think it is working since the contour plot after the rotation should not be symmetric.
Hope anyone can help,
z = 10;
r = sqrt(x.^2+y.^2+z.^2)*1e-9;
B = const*((300e-18)./r.^5-1./r.^3)*1e6;
phi = 53;
%rotation around Z axis
X = x.*cos(phi) - y.*sin(phi);
Y = x.*sin(phi) + y.*cos(phi);

Answers (1)

Naman Chaturvedi
Naman Chaturvedi on 20 Sep 2018
Edited: Naman Chaturvedi on 20 Sep 2018
You aren't plotting the updated values X and Y. Last line should be:-
>> contourf(X,Y,B,25,'LineStyle','none')
  1 Comment
Laura Mugica
Laura Mugica on 20 Sep 2018
I get exactly the same plot when I use contourf(X,Y,B,25) that's why I think it's not working.

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!