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

조회 수: 14 (최근 30일)
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 CenterFile Exchange에서 2-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