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 件のコメント

José-Luis
José-Luis 2016 年 7 月 4 日
編集済み: José-Luis 2016 年 7 月 4 日
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.
wkm42
wkm42 2016 年 7 月 4 日
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 2016 年 7 月 4 日
編集済み: wkm42 2016 年 7 月 4 日
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)])
José-Luis
José-Luis 2016 年 7 月 4 日
Sorry, I don't get it.
How do you define your brackets?
What is the result you expect? Why [2,2]?
wkm42
wkm42 2016 年 7 月 4 日
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..
José-Luis
José-Luis 2016 年 7 月 4 日
That still looks like interpolation to me. It looks like you might want to find the nearest neighbor.
wkm42
wkm42 2016 年 7 月 4 日
編集済み: wkm42 2016 年 7 月 4 日
Still 'griddata' interpolates when there are no datapoints, but doesn't when there are..
José-Luis
José-Luis 2016 年 7 月 4 日
Then don't use griddata().
interp2() might provide what you need.
Did you actually look at the nearest neighbor solution I previously suggested?
wkm42
wkm42 2016 年 7 月 4 日
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
José-Luis
José-Luis 2016 年 7 月 5 日
I'm sorry: I don't quite get what you are after. Maybe try the 'nearest' option for griddata()?

サインインしてコメントする。

回答 (1 件)

Radu Trimbitas
Radu Trimbitas 2016 年 7 月 4 日

0 投票

interp2() has options for cubic or spline

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

製品

質問済み:

2016 年 7 月 4 日

コメント済み:

2016 年 7 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by