Clear Filters
Clear Filters

Interpolation on multiple data sets

15 views (last 30 days)
Jack
Jack on 20 Oct 2023
Commented: Jack on 21 Oct 2023
I have been given data for performance of a jet engine (can't share actual data) that for a set of altitudes and mach numbers gives a range of possible thrust values (min, max, and several datapoints in between). Each of these values has a corresponding fuel consumption value. Image a table for M0.25 at 10000ft containing thrust at 10, 40, 70, 100% throttle with a fuel consumption for each, repeated many times for diffferent combinations of mach and altidude.
I'm attemping to create a function that for a known altitude and mach (could be in between the tables I have) and a required thust (also could be in between the datapoints) will return the corresponding fuel consumption. I'm aware how to do basic interpolation in MATLAB, but I'm stuggling to conceptualise how the multiple layers of interpolation will work and none of the answers on here touch on how to handle the 'inverse interpolation' to find the required point on the thrust dataset and then extract the value at the corresponding point on the fuel consumtion dataset.
Can anyone suggest how best to lay this out or provide some starting points?
  1 Comment
Jack
Jack on 21 Oct 2023
I've added this screenshot and discription as a comment on an answer but putting here too for visibility since I don't think I was clear.
The screenshot attached is a dummy sample of what I have, and then repeated for 15000ft and so forth. I need to be able to say 'I need 13500N at M0.375 and 12000ft, what's the Fuel value?'.
(I also didn't chose how this data was layed out in the spreadsheet I'm pulling from!)

Sign in to comment.

Answers (2)

Voss
Voss on 20 Oct 2023
Have you tried interpn?
thrusts = 0.1:0.3:1;
altitudes = 10000:1000:12000;
mach_numbers = 0.25:0.1:0.75;
[T,A,M] = ndgrid(thrusts,altitudes,mach_numbers);
fuel_consumption = rand(size(T)); % random data
given_thrust = 0.55;
given_altitude = 10300;
given_mach_number = 0.37;
result = interpn(T,A,M,fuel_consumption,given_thrust,given_altitude,given_mach_number)
result = 0.2942
  1 Comment
Jack
Jack on 21 Oct 2023
Thank you for responding! I think I struggled to articulate the problem and don't think I was clear enough about the data.
The screenshot attached is a dummy sample of what I have, and then repeated for 15000ft and so forth. I need to be able to say 'I need 13500N at M0.375 and 12000ft, what's the Fuel value?'.
I think your solution is the perfect method for finding the interpolated value at a known point in the fuel consumption data, but what I'm having issues with is the initial step of finding the index of a value that needs to be interpolated in the thrust data to do that. Does that make sense?

Sign in to comment.


Sulaymon Eshkabilov
Sulaymon Eshkabilov on 21 Oct 2023
If understood correctly, the interpolation can be done using matlab's builtin fcns interp1() for 1D, interp2() for 2D, interp3 for 3D, interpn() for N-D gridded data - SEE. E.g.:
% interp1() - 1D interpolation
D = load('DATA2_PE.txt');
Ne = D(:,1); % Engine speed in rpm
% P10 = D(:,2); % Engine Power @ throttle opening of 10%
P100 = D(:,end); % Engine Power @ throttle opening of 100%
Ne_int = min(Ne):100:max(Ne); % Interpolate at: Ne_int rpm values
% Interpolated Power values are computed here:
P100_int = interp1(Ne,P100, Ne_int, 'cubic'); % Interpolation values: P100_int(Ne_int)
figure()
plot(Ne, P100, 'ro', 'markerfacecolor', 'y', 'markersize', 10)
hold on
plot(Ne_int, P100_int, 'b', 'linewidth', 2)
grid on
legend('Experimental Engine Data', 'Interpolated values', 'location', 'best')
xlabel('N_e, [rpm]')
ylabel('P_e, [kW]')
% interp2() - 2D interpolation
D2 = load('Ne_Pe.txt');
Ne = D2(2:end,1); % Engine speed in rpm
Pe = D2(2:end,2:end); % Engine Power @ throtle opening values in %
Throt = D2(1,2:end);
figure(2)
[N_Ne, T_Throt] = meshgrid(Ne, Throt);
surf(N_Ne, T_Throt, Pe')
xlim([800, max(Ne)])
figure('Name', 'Interpolated Values')
[Ne_int, Throt_int] = meshgrid(min(Ne):100:max(Ne), min(Throt):2:max(Throt));
% Interpolated Power values are computed here:
Pe_int = interp2(N_Ne,T_Throt, Pe', Ne_int, Throt_int); % Pe(Ne, Throttle)
surf(Ne_int, Throt_int, Pe_int)
grid on
xlabel('N_e, [rpm]')
ylabel('Throttle position, [%]')
zlabel('P_e, [kW]')
  1 Comment
Jack
Jack on 21 Oct 2023
Thank you for replying! The part I'm struggling with isn't interpolating the data, it's trying to find the position of a particular value or 'inverse interpolation' which I think is the right term. Would you take a look at my comment under the original question as that explains what i'm trying to accomplish better?

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!