Creating an ellipsoidal 3D surface I am trying to find the equation of a 3D ellipsoidal surface. I have thought of two approaches which are schematically shown below:
By revolving an elliptical arc over a 3D elliptical path:

Or by scaling an elliptical arc while translating in $z$-direction:

I thought the first approach (revolving) is easier. Here is my description of what I have done. The elliptical arc segment, which lies in $xy$-plane, that revolves around $y$-axis on an elliptical path (non-circular) to create a 3D ellipsoidal surface.
The revolving elliptical segment has the following equation ($0<\theta\le\pi/2$):
$$\frac{x^2}{R_x^2}+\frac{y^2}{R_y^2} = 1,\mathrm{\ \ \ or\ \ \ } \begin{cases}
    x = R_x\cos\left(\theta\right)\\
    y = R_y\sin\left(\theta\right)
  \end{cases}$$
The revolving angle is called $\phi$ and revolves $0<\phi\le\pi/2$ in the $xz$-plane according to the following elliptical path:
$$\frac{x^2}{{R^\prime}_x^2}+\frac{z^2}{R_z^2} = 1, \mathrm{\ \ \ or\ \ \ } \begin{cases}
    x = {R^\prime}_x\cos\left(\phi\right)\\
    z = R_z\sin\left(\phi\right)
  \end{cases}$$
While revolving I want to scale down $R_y$ according to $\phi$:
$$R_y = h\cos\left(\phi\right)$$
where $h$ is a constant. So, as the elliptical arc revolves by $\phi$, $R_y$ decreases and so as $R_x$.
In the $\phi$-plane, the points on the revolved ellipse has the following equations:
$$\begin{cases}
    x = {\left(\left[{{R^\prime}_x}\cos\left(\phi\right)\right]^2+\left[R_z\sin\left(\phi\right)\right]^2\right)}^\frac12\cos\left(\theta\right)\\
    y = h\cos\left(\phi\right)\sin\left(\theta\right)\\
z = R_z\sin\left(\phi\right)
  \end{cases}$$
When I plot the above parametric equations in MATLAB I don't get the expected surface. Could someone kindly help me?
% Here is the MATLAB code I used.
Rx = 1;
Rz = 1;
h  = 2;

n = 100;
[theta, phi] = meshgrid(linspace(0,pi/2,n), linspace(0,pi/2,n));

x = (Rx^2*cos(phi).^2+Rz^2*sin(phi).^2).^0.5.*cos(theta);
y = h*cos(phi).*sin(theta);
z = Rz*sin(phi);

surf(x,y,z), shading interp, axis equal, xlabel('x'), ylabel('y'), zlabel('z')

Here is the MATLAB result:


The following should fulfill your requirements. It is the subsurface of an elliptical $z$-axis cylinder $(x/R_x)^2 + (y/R_y)^2 = 1$, that is contained within the filled elliptical $y$-axis cylinder $(x/R_x)^2 + (z/R_z)^2 < 1$.
$$M:=\{(x,y,z) \in \mathbb{R}^3 : (x/R_x)^2 + (y/R_y)^2 = 1; (x/R_x)^2 + (z/R_z)^2 < 1 \textrm{ and } x>0, z>0\}$$
Rx = 3;
Ry = 2;
Rz = 6;

n = 100;
x = linspace(0,Rx,n);
z = linspace(0,Rz,n);
[U, V] = ndgrid(x, z);

X = U.*sqrt((1-(V/Rz).^2));
Y = sqrt((1-(X/Rx).^2)*Ry^2);
Z = V;
surf(Z,X,Y); % The ordering is just swapped so we can rotate it more easily!
xlabel('z'), ylabel('x'), zlabel('y');
shading interp;
axis equal; axis vis3d;


