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

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by