How to interpolate a column array based on another non-linearly spaced column array?

5 views (last 30 days)
Ananya Srivastava
Ananya Srivastava on 20 May 2022
Answered: Star Strider on 20 May 2022
I have two data sets - emission spectrum of a black body in the wavelength range 1 to 10 µm and absorption spectrum of a gas in the same wavelength range. The problem is that the emission spectrum contains only 901 data points, whereas, absorption spectrum contains 136442 data points, which are non-linearly spaced. There is a very high density of data upto 6µm compared to 6-10 µm. I have to finally overlapp the two data i.e. show emission spectrum before and after gas absorption. How can I interpolate the emission spectrum with the same non linear spacing of the wavelength?

Answers (2)

dpb on 20 May 2022

Star Strider
Star Strider on 20 May 2022
As a general rule, it is best to interpolate a longer vector to a shorter vector in order to avoid creating data that interpolating a shorter vector to a longer vector would do. I am guessing what the (x,y) relationship of these vectors are, since that has not been stated.
Try this —
LD = load('Emission_absorption_plots_CO2_variables_2.mat');
abs = LD.abs_1_10;
nu_abs = LD.nu_1_10_abs;
emis = LD.emis_1_10;
nu_emis = LD.nu_1_10_emis;
[Unu_abs,ix] = unique(nu_abs);
Uabs = abs(ix);
abs2 = interp1(Unu_abs,Uabs,nu_emis);
yyaxis left
yyaxis right
This performs the interpolation and plots the results. I have no idea what you want to do with them.

Community Treasure Hunt

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

Start Hunting!