How to create 3D grid from data without interpolation?

Hey,
is there some function like griddata which doesnt interpolate the z data? I need some function to save all z values or the mean in the specific x,y segment.
Thanks for you help!

10 commentaires

José-Luis
José-Luis le 4 Juil 2016
Modifié(e) : José-Luis le 4 Juil 2016
If you don't interpolate, then how do you get the data? Taking the mean is pretty much a linear interpolation, if I understood what you meant correctly.
I have x,y,z datapoints and would like to sort them in x,y segments. So the function i'm looking for could save all the z datapoints in the x,y segments or just their mean value.
wkm42
wkm42 le 4 Juil 2016
Modifié(e) : wkm42 le 4 Juil 2016
For example:
Datapoints:
x: torque = [12,13,20,30]
y: speed = [512,800,1300,1506]
z: z = [2,2,1,4]
Intervalls of my desired grid:
torque_intervall = [10,20,30]
speed_intervall = [500,1000,1500,2000]
The function im looking for:
output = gridfunc(torque,speed,z,torque_intervall,speed_intervall)
output(torque=10..20,speed=500..1000)= [z(1),z(2)]
or
output(torque=10..20,speed=500..1000)= mean([z(1),z(2)])
Sorry, I don't get it.
How do you define your brackets?
What is the result you expect? Why [2,2]?
I edited my example above and hope its reasonable now ;)
Your suggestion 'linear interpolation' is kinda what I'm looking for, but still griddata interpolates outside of the datapoints and misses some of the datapoints inside the grid..
That still looks like interpolation to me. It looks like you might want to find the nearest neighbor.
wkm42
wkm42 le 4 Juil 2016
Modifié(e) : wkm42 le 4 Juil 2016
Still 'griddata' interpolates when there are no datapoints, but doesn't when there are..
Then don't use griddata().
interp2() might provide what you need.
Did you actually look at the nearest neighbor solution I previously suggested?
Yes, but nearest neighbor doesnt seem to be a solution..
interp2(): If X and Y are grid vectors, then V must be a matrix containing length(Y) rows and length(X) columns.
I just got z as a vector
I'm sorry: I don't quite get what you are after. Maybe try the 'nearest' option for griddata()?

Connectez-vous pour commenter.

Réponses (1)

Catégories

En savoir plus sur Interpolation dans Centre d'aide et File Exchange

Produits

Question posée :

le 4 Juil 2016

Commenté :

le 5 Juil 2016

Community Treasure Hunt

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

Start Hunting!

Translated by