Finding a specific value in Y-axis value with known X-axis value

4 views (last 30 days)
Hi, I am trying to find a specific value in Y-axis value with known X-axis value as follow;
Alt = [11000,12000,13000,14000,15000,16000,17000,18000]; % Altitude [m]
Relative_density_ISA = [0.2971,0.2537,0.2167,0.1851,0.1581,0.1350,0.1153,0.0985]; % Relative density under ISA
I am trying to find the altitude which relative density 0.1291 is at.
I applied the -> R_D_wanted =interp1(Alt,Relative_density_ISA,0.1291);
but it gives me NaN result.
Please help, very much appreciated.

Accepted Answer

Matt J
Matt J on 15 Sep 2023
Edited: Matt J on 15 Sep 2023
Alt = [11000,12000,13000,14000,15000,16000,17000,18000]; % Altitude [m]
Relative_density_ISA = [0.2971,0.2537,0.2167,0.1851,0.1581,0.1350,0.1153,0.0985]; % Relative density under ISA
Alt_wanted =interp1(Relative_density_ISA,Alt,0.1291,'linear')
Alt_wanted = 1.6299e+04

More Answers (1)

Dark_Knight
Dark_Knight on 15 Sep 2023
Hello Ke Yeun Yong , hope this helps.
% Given Input Data
Alt = [11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000];
Relative_density_ISA = [0.2971, 0.2537, 0.2167, 0.1851, 0.1581, 0.1350, 0.1153, 0.0985];
% Relative Density required
R_D_wanted = interp1(Relative_density_ISA, Alt, 0.1291); % 1.6299e+04
% Relative Density required
R_D_wanted = num2str(interp1(Relative_density_ISA, Alt, 0.1291)); % '16299.4924'

Categories

Find more on Interpolation 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!