How to interpolate data points in 3 directions with non unique grid coordinates

3 ビュー (過去 30 日間)
Toon
Toon 2018 年 2 月 19 日
コメント済み: Toon 2018 年 2 月 20 日
Hi,
I am trying to interpolate data from a gas turbine. I simulated it at different points (different altitudes, mach numbers and power settings) and obtained the fuel consumption on these points. I am trying to interpolate the altitudes, mach numbers and power settings such that the fuel consumption on every interpolated point is known.
My data file is included as data.csv
I have been messing around with interp3 but I cannot get it to work. It usually gives my trouble because not all points are unique or it give me an error saying "The grid vectors do not define a grid of points that match the given values."

採用された回答

John D'Errico
John D'Errico 2018 年 2 月 19 日
編集済み: John D'Errico 2018 年 2 月 19 日
Scattered data interpolation is the case where your data points are randomly scattered, not on some regular lattice.
Interp3 applies to the case where your data lies on a regular lattice, in 3 dimensions for the independent variables.
Now, lets look at your data. Is it scattered? NO!!!! It lies on a nice rectangular grid, in 3 dimensions.
That the lattice is not a perfectly regular one is not important. I stored it in an array called xyzw.
altitude = permute(reshape(xyzw(:,1),[7 5 4]),[2 3 1]);
machnum = permute(reshape(xyzw(:,2),[7 5 4]),[2 3 1]);
powersetting = permute(reshape(xyzw(:,3),[7 5 4]),[2 3 1]);
fuelcons = permute(reshape(xyzw(:,4),[7 5 4]),[2 3 1]);
Now, lets try using interp3.
interp3(altitude,machnum,powersetting,fuelcons,1500,0.23,1900)
ans =
0.16129
The trick is that you needed to get those arrays in the correct order. You can see I had to be careful, using a reshape and a permute.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by