Let's start with a basic example:
hfs = fsurf(@(x,y) 5*besselj(1,hypot(x,y)));
Xm = reshape(hfs.XData(1:smd^2),smd,[]);
Ym = reshape(hfs.YData(1:smd^2),smd,[]);
Zm = reshape(hfs.ZData(1:smd^2),smd,[]);
[F V] = surf2patch(hs,'triangles');
stlwrite(triangulation(F,V),'test1.stl')
surf2stl('test2.stl',Xm,Ym,Zm)
There you have two ways to get the data into an STL. There are some problems though. Let's look at the STL:
As simple as this height map is, the usefulness of the result depends on what you're trying to do with the STL. Bear in mind that this mesh describes an open surface with zero thickness. If you just need a way to transport a mesh for some sort of mathematical analysis, then maybe it's fine. However, if you're trying to use it as a solid model, it's not a solid.
Consider another case where the result may be problematic:
xfcn = @(u,v) A*(cos(u).*cos(2*v) + B*sin(u).*cos(v)).*cos(u) ./ (B - sin(2*u).*sin(3*v));
yfcn = @(u,v) A*(cos(u).*sin(2*v) - B*sin(u).*sin(v)).*cos(u) ./ (B - sin(2*u).*sin(3*v));
zfcn = @(u,v) B*cos(u).^2 ./ (B - sin(2*u).*sin(3*v));
hfs = fsurf(xfcn,yfcn,zfcn,[0 pi 0 pi]);
This surface is self-intersecting and one-sided, so half of it is inside-out. We can apply the same code to generate the STL. Here we can see where the two sides of the surface connect, and we can see that much of the surface normals are reversed. If you needed this to be a solid model, fixing the triangulation would be quite a bit more challenging than the prior height map.
Now let's consider the given problem:
f_y = @(u,v) 1.04*sin(u);
f_z = @(u,v) 2.4*sin(v).*sin(u);
hfs = fsurf(f_x,f_y,f_z, [urange vrange]);
As before, we don't see any problems yet. Let's look at the STL:
Because we're producing duplicate Zdata, we end up with a ton of (nominally) coincident faces with opposite face normals. It's a little more complicated than that, but let's just say it's probably not good. If we restrict the range of v, we cover one side of the surface.
The result is now like it was in the first example, a simple open surface.