Interpolation on multiple data sets
Show older comments
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?
Answers (2)
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)
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]')
Categories
Find more on Resizing and Reshaping Matrices 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!

