bounding Interpolation of scatter data to boundaries of the data

4 Ansichten (letzte 30 Tage)
Ali Ahmed
Ali Ahmed am 7 Jul. 2021
Kommentiert: Stephen23 am 7 Jul. 2021
All of the examples I have seen involing scatterInterpolant use the meshgrid function, which seems to result in interpolating scatter data to a defined cubic volume.
My scattered data is of the shape of a dome, and would like to limit the interpolation to this shape. I want to interpolate this scattered data and display a 3d plot with slices, and use the interpolated output to color the data. I have gotten this to work, but am getting colors in the areas outside of the dome shape where there are no scatter points.
The current idea I have is to find the top surface bounding my data, and then set all outputs of the interpolation above the surface equal to NaN so as to not color them. Is there an easier way to do this? Is there an interpolating function that bounds to the given data, or could I define a mesh grid only for points under the surface of the dome?
Thanks in advance
  5 Kommentare
Ali Ahmed
Ali Ahmed am 7 Jul. 2021
Bearbeitet: Ali Ahmed am 7 Jul. 2021
Ok this makes sense, but I think the problem lies in trying to setup the data for the slice function which takes data in meshgrid format.
Below is what I am trying to do - Is this the right approach. Currently I get an error with ndgrid since x,y,z,c are 10242x1 dimension vectors, and scatteredInterpolant returns the same number of points. Is there a way to interpolate to a reduced number of datapoints?
F = scatteredInterpolant(x,y,z,c);
[X,Y,Z,V] = ndgrid(F.Points(:,1),F.Points(:,2),F.Points(:,3),F.Values)
slice(X,Y,Z,xslice,yslice,zslice)
x,y,z are the dimensions of each point, c is the value assigned - which will determine the points color in the graph
Thanks in advance!
Stephen23
Stephen23 am 7 Jul. 2021
"but I think the problem lies in trying to setup the data for the slice function which takes data in meshgrid format."
That is a very different question to what you asked about.
If SLICE has specific requirements (I have not looked) e.g. it only works on gridded data, then of course that is what you will have to provide it with. As KSSV wrote, you could set values to NaN, which might give the effect you want.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by