%% Apply Translation and Rotation to Ellipsoid
% Generate coordinates of an ellipsoid with a center at (0, 0, 0) and semiaxis lengths (1.5, 1.5, 3).

[X,Y,Z] = ellipsoid(0,0,0,1.5,1.5,3);

% Create a surface plot of the ellipsoid.

surf(X,Y,Z);
axis equal

%
% Plot a second ellipsoid with its center translated by (3, 0, 5) from the first ellipsoid. To be able to rotate the second ellipsoid in the next step, return the surface object as s.

hold on
s = surf(X+3,Y,Z+5);

%
% Rotate the second ellipsoid by 45 degrees around its x-axis. The new coordinates of the translated and rotated ellipsoid are stored in s.Xdata, s.Ydata, and s.Zdata.

direction = [1 0 0];
rotate(s,direction,45)

%
% Copyright 2020 The MathWorks, Inc.