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

14 ビュー (過去 30 日間)
Ananya Srivastava
Ananya Srivastava 2022 年 5 月 20 日
回答済み: Star Strider 2022 年 5 月 20 日
Hello,
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?

回答 (2 件)

dpb
dpb 2022 年 5 月 20 日

Star Strider
Star Strider 2022 年 5 月 20 日
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);
figure
yyaxis left
plot(nu_emis,emis)
ylabel('emis')
yyaxis right
plot(nu_emis,abs2)
ylabel('abs')
grid
This performs the interpolation and plots the results. I have no idea what you want to do with them.
.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by