필터 지우기
필터 지우기

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

조회 수: 4 (최근 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