How can I interpolate lines and colonnes
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a table that I need to interpolate using two inputs. I want to be able to input weight and FL values and return an interpolated value from the table. I've attached a picture for clarification, any help would be awesome. Thanks.
0 Kommentare
Antworten (1)
Star Strider
am 17 Jun. 2022
First, all four of those matrices would have to be entered separately.
Second, use ndgrid to create the matrices from the necessary vectors, and then use griddedInterpolant to do the actual interpolation. See the griddedInterpolant documentation for details.
Example —
From the lower left part of the table for the ‘TIME’ matrix —
FL = [15 50 100 120];
Wgt = 58:2:62;
TIME = [1 1 1; 2 2 2; 3 3 4; 4 4 5];
[FLm,Wgtm] = ndgrid(FL, Wgt);
TIMEi = griddedInterpolant(FLm,Wgtm,TIME);
FLq = 75;
Wgtq = 61;
TIME_75_61 = TIMEi(FLq,Wgtq)
figure
surf(FLm,Wgtm,TIME, 'FaceAlpha',0.75)
hold on
stem3(FLq, Wgtq, TIME_75_61, '^r', 'MarkerFaceColor','r')
hold off
grid on
xlabel('Flight Level')
ylabel('Weight (1000 kg)')
zlabel('Time (Min)')
So, under those conditions, for the airplane to reach Flight Level 75 (7500 feet assuming ISA conditions) with a Weight of 61 kg, it would take (using linear interpolation) about 2 min 45 sec.
.
2 Kommentare
Star Strider
am 17 Jun. 2022
My pleasure!
‘I don't know how to interpolate if both of FL and weight values aren't in the table’
They have to be there. How the matrix and the interpolation is done depends on the the necessary variables being in the table. I demonstrated how to do that, so that FL and Weight refer to the other variables. The matrices themselves (I used TIME here) can be imported as such from Excel or whatever else they are stored in. Use ndgrid to create the FL and Weight matrices that griddedInterpolant can use for its interpolations.
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!