Info

This question is closed. Reopen it to edit or answer.

How do I extend a mesh or surf figure?

1 view (last 30 days)
Majid
Majid on 20 Sep 2021
Closed: Majid on 1 Oct 2021
Before you start reading the question, I would like to let you know that I got some great suggestion on this problem in this link.
It has been a while I am trying to solve this problem but without any notable progress! Any help would be appreciated.
In summary: I have several points on the upper half of a rotated ellipsoid which are non uniformly distributed. I need to plot the half part of this rotated ellipsoid. I used the griddata() function in matlab to find a set of uniformly distributed points of surface to be able to plot it by using the mesh() function. However, the problem is that I cannot get to a complete surface figure!!!
Please see the attached photos for a better understanding. I need to plot only the half surf, but I attached a figure with two sides just to be more clear which part of the half-surf is missing.
The points are the solutions of the following equation:
in which the variables are xv, yv, and zv.
I solved the equation by using the solve() function for zv. Then, I generated xv and yv variables by using the linspace() and meshgrid() functions, and calculated the corresponding zv variables by using subs() function.
Anyone have any ideas on how I can extend the surf to be complete? I tried several times to generate more points by solving the equation in several ways, but I could not get a satisfactory result. Also, I used some extrapolation functions in Matlab as scatteredInterpolant() with different methods linear and natural, but the output was something with many extra meshes.
Any ideas? I need extend the surf to be complete (actually, half of it).
  4 Comments
Sargondjani
Sargondjani on 20 Sep 2021
It is not clear to me what you exactly want. I mean, if you choose your x and y points such that they contain the half-surface, it should be fine, no?
And why don't you:
  1. construct a uniformly spaced mesh for x and y
  2. solve for z (using an initial guess that ensures you get the upper solution) for each gridpoint
  3. plot x,y,z surface
Majid
Majid on 20 Sep 2021
Edited: Majid on 20 Sep 2021
Thanks for your point. As I explained in the question, I constructed a uniformly spaced mesh of x-y plane by using linspace() and meshgrid() functions of Matlab. However, the solutions of the equation (the z values) are not all real for all the considered points, and so I lose some of the initial points, leading to non-uniformaly distributed points on xy plane.
By the way, if I would have all the points on the desired surface, I know how to plot its half. The point is that I do not have the points I want, and accordingly, as I explained in the question, I used the griddata() and scatteredInterpolant() functions to interpolate (and hopefully extrapolate) points on the desired surface to help me out. However, it did not work very well. If you see the title of the question, I do not want to resteric a surf, which is what you did in the frist place, but I need to extend it.

Answers (0)

Community Treasure Hunt

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

Start Hunting!