Two minute video shows how to fit a surface to nonuniform data.
Real data is not always on a nice X,Y grid, but the MATLAB commands
SURF and MESH expect them to be. GRIDDATA and MESHGRID help to fix this.
I am very grad to find the program of “advanced-matlab-surface-plot-of-nonuniform-data”, but I could not run it
because of no-coincide of matrix dimension.
Would you please inform me of a mistake I coded (copied).
%3D graph for nonuniform_data
mesh(X,Y,Z); % interpolated
axis tight; hold on
This info about making a surface plot was very usefull for me. In stead of the formule that you used to produce some points, I used 4 XYZ-coordinates that result in an surface in 3D. Is there an easy way to calculate the surface area of this created object?
There is no built in function to do this, but knowing the X,Y,Z of each point in the mesh, you should be able to calculate the area of each four point patch. From there, summing should be easy to know the whole area.
I am not sure that I understand the question. If you have x,y,z triples, you just plot them. Are you trying to fit a polynomial to them? That would imply a two dimensional dataset. Are you trying to fit some kind of a surface to the data?
Thanks for these videos, they have really helped me alot. I am currently looking to create a surface plot (non uniform data) but I would like to represent it in the z-axis. To explain myself better:
If you think of various layers of semi circles made up of dots, and as you move ‘up’, the number of dots are increasing, so it ends up looking like a funnel. Now the code you presented here creates a surface for each circle (ie. for each layer), but now I want to create a surface joining the layers. I hope I have explained myself adequately. Thanks again and I would really appreciate your input.
Is there anyway to plot a surface from nonuniform data without meshgrid and griddata? Basically i have topographic information, where the altitude(z) at each x and y is known.
I do not want any interpolation in between. x and y do not form a rectangular grid but are closely spaced.
I have written the following script based on your lesson. The surface which i end up in seems not be correctly reflect the data point i have. Would you please have a look and tell me what could be wrong here?
Thanks for the fantastic demonstration. I tried to figure out how to generate surface plots for non-uniform data a couple of times before but never found somebody who was able to explain it to me. I got it know and my surface plot looks fantastic. At those moments I love the internet and the helpful guys like you who give their time to help me understand…
Thank you so much.
The code works well, but for relatively small arrays.
I have over 300,000 points, so griddata doesn’t have enough memory to handle the data.
TriScatteredInterp doesn’t work well for me too, because the surface it generates isn’t smooth.