Azzera filtri
Azzera filtri

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

4 visualizzazioni (ultimi 30 giorni)
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."

Risposta accettata

John D'Errico
John D'Errico il 19 Feb 2018
Modificato: John D'Errico il 19 Feb 2018
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.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by