Clear Filters
Clear Filters

3D ellipsoid turns 2D after rotation

1 view (last 30 days)
Hello!
I am currently working on a program that requires the rotation of an ellipsoid in 3D space. Previous questions like this lead me to the "rotate" function where I could input an angle for the three axes. The issue is when I rotate about either the y or z axes, my ellipsoid turns 2D. When I rotate about both the y and z axes, the surface turns into a line. This rotation works fine around the x-axis.
Code Below:
% Get fz ellipsoid points
[ex,ey,ez] = ellipsoid(xc,yc,zc,foci2end,fzradius,fzradius);
figure(1)
hold all;
% Fresnel Zone
fresnelzone = surf(ex,ey,ez); % Surface Plot
set(fresnelzone,'EdgeColor','none'); % Edge Color/Transparency Settings
set(fresnelzone,'FaceAlpha','.4');
% Rotate Ellipsoid
rotate(fresnelzone,[1 0 0], angle_x);
rotate(fresnelzone,[0 1 0], angle_y);
rotate(fresnelzone,[0 0 1], angle_z);
% Plot Label/View Settings
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
view(3);
Thanks for any help!!

Accepted Answer

Shadaab Siddiqie
Shadaab Siddiqie on 28 Aug 2020
I have implemented the function and found even a rotation across y or z axis, I am still getting an 3D ellipsoid. Note that you can view the ellipsoid from different angles with the help of the cursor (mouser). Also make sure that neither of the semi-axis lengths are zero. For more information please visit https://in.mathworks.com/help/matlab/ref/surf.html
  1 Comment
Kenton Young
Kenton Young on 28 Aug 2020
Thanks for the help! I found out my y-axis calculation resulted in a zero with the data I was using.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!