Hello,
I have a function f(x) which is in 2D, allowing me to make surf plot. To make the surf plot, I discretise the space and do 2 for loops over the x and y indecies to get a matrix of Z values. I then use the surf command to plot this surface.
However, I would like to cut the surface at all Z values above a critical value to produce a smooth boundary. I do this by simply removing the values of the Z matrix which are above a critical value by setting those to "nan".
When I plot this new Z matrix (with some enteries as "nan") , I get a choppy border, see the figures below. I know this is because my space is discretised into a finite grid of points, and I could just increase the number of points, however since the function is expensive to evaluate, I don't want to do this methid.
Is there another way to plot the surface with a smooth boundary?
Many thanks.