"Scattered Interpolant" produces invalid values

9 views (last 30 days)
Laz-os
Laz-os on 28 May 2020
Commented: Laz-os on 29 May 2020
Hi there, i am trying to interpolate the attached file and in some cases it the "scatteredinterpolant" produces invalid values.
Here is my code:
Tb1 = importdata('EngineModelMap.csv',';');
Tb = Tb1.data;
Tb = sortrows(Tb,[1 2]);
TET = Tb(:,3);
TH = Tb(:,4);
SFC = Tb(:,5);
ALT = Tb(:,1);
MACH = Tb(:,2);
f_TET = scatteredInterpolant(ALT,MACH,TH,TET,'natural','none');
f_sfc = scatteredInterpolant(ALT,MACH,TET,SFC,'natural','none');
f_Thrust = scatteredInterpolant(ALT,MACH,TET,TH,'natural','none');
Alt = 7000;
M = 0.6;
Tr = 13.21;
tet = f_TET(Alt,M,Tr);
sfc = f_sfc(Alt,M,tet);
ff = Tr*sfc;
% SEP,fs (max Thrust)
tetM = 1500; %max(TET);
sfcM = f_sfc(Alt,M,tetM);
Tmax = f_Thrust(Alt,M,tetM);
The issue i encounter is that some combinations that should be outside the engine map, are treated as they are inside it. For example if you set as initial values Alt=7000,M=0.6,Tr=13.21 and take a look at the imported file you will notice that Tr is out of range and thus when the tet=f_TET(Alt,M,T) is calculated should return tet=NaN. In this case though, the interpolation returns tet=1500, which is the maximum value for tet. A way to validate this miscalculation is that later on when Tmax is calculated and tet is set to 1500 (maximum tet for max thrust) the returning Tmax is ~10.
It seems like it is extrapolating, although i have disabled extrapolation.
How can i fix this issue?
  6 Comments
darova
darova on 28 May 2020
Is it possible to see the problem visually? Something like slice or isosurface?
Laz-os
Laz-os on 28 May 2020
Edited: Laz-os on 28 May 2020
Sorry but i havent tried any visual representation! The best derscription is the one i wrote in the main post :-(. What should i do to help you? The case i give as an example is just a sample that i observed the anomaly...

Sign in to comment.

Answers (2)

John D'Errico
John D'Errico on 28 May 2020
Edited: John D'Errico on 28 May 2020
I can shed light on your problem. What you think of as extrapolation is different from the way scatteredInterpolant sees the concept. The problem is, your data lives in a domain that is not a convex set.
And, while you THINK that the point you show is not inside the data, it IS inside the convex hull of the data. (Not difficult to prove. I've done so.)
So what does extrpolation mean to a tool like scatteredInterpolant? That means predicting a value that lies OUTSIDE of the convex hull of the data. These tools work via triangulations of the domain - Delaunay triangulations, which result in convex things. The outer boundary surface of a Delaunay triangulation is in fact the convex hull of the data. So even though your data happens to look non-convex, scatteredInterpolant does not care in the least. It creates a triangulation that contains everything that lies inside the convex hull of your data. Anything inside that hull is interior to the data, as far as it cares.
Extrapolation is only needed when a point falls outside of that convex hull. That is where your assumptions fall apart.
  3 Comments
John D'Errico
John D'Errico on 29 May 2020
I understand your point. However, your point is not relevant. Software is written as it is written, to do what it is designed to do. That you want it to perform in a different way is not going to get you far. If you use the wrong software, or if you use that software in the wrong way, what do you expect?
scatteredInterpolant is designed to work WITHIN the convex hull of the data. It does not know the physics of your problem, nor could it possibly care. It is just software. You gave it some numbers. Effectively the code follows a simple flow chart:
Is the point within the convex hull?
yes?: Do the interpolation as designed.
No?: Extrapolation! BAD! DANGER!
And you need to understand that what scatteredInterpolant defines as an extrapolation is not what you think extrapolation means. They are different things, but when you use scatteredInterpolant, you play by its rules.
Now to your comment. "it is unnatural to have greater thrust than the one that that you get with maximun engine temperature".
You have used software to interpolate data that is not convex. It produces an approximation based on interpolation as it is designed to do, where the point happens to lie in a region that is outside of the valid parameter space. But since the point is inside the convex hull of the data, garbage arises because the interpolant was still happy. And that should not be a surprise.
Remember that interpolation is just an approximation! When used to predict a value at some location that is between points in your data, there is no presumption it will produce the theoretically correct value, because the interpolation scheme does not understand the physics of your problem.
You are thinking physics with all of its glorious and sutble nonlinearities, but forgetting that interpolation is not physics.
Laz-os
Laz-os on 29 May 2020
I didnt mean to change the software's principles, nor did i expected to make it work in a way that its not designed to. I preseneted my case to find out if there is any workaround. I get that this is they way scatteredInterpollant works but is there any other way i can make my estimations? Maybe by reforming my data or by using any other workflow or function ?!

Sign in to comment.


darova
darova on 28 May 2020
Edited: darova on 28 May 2020
Here are some of your data
scatter3(ALT,MACH,TH,20,TET,'fill')
I used slice to see how the interpoalted data looks
[x,y,z] = meshgrid(0:1e3:15e3,0:0.1:1,0:1:20);
v = f_TET(x,y,z);
hold on
for iso = linspace(min(z(:)),max(z(:)),5)
% isosurface(x,y,z,v,iso)
slice(x,y,z,v,[],[],iso)
end
hold off
And it looks pretty logical. Isn't it?
I tried isosurface
[x,y,z] = meshgrid(0:1e3:15e3,0:0.1:1,0:1:20);
v = f_TET(x,y,z);
hold on
for iso = linspace(min(v(:)),max(v(:)),5)
isosurface(x,y,z,v,iso)
% slice(x,y,z,v,[],[],iso)
end
hold off
And it looks ok for me as well
Can explain more about the problem?
  9 Comments
darova
darova on 29 May 2020
Hm. I don't have any other ideas. Maybe John D'Errico can help you, see answer below
Laz-os
Laz-os on 29 May 2020
Anyway thanks for your effort! :-D

Sign in to comment.

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!