I have two text files, one for system response and other with sample. Both has the same wavelength range from 1400-2000 nm. In system response machine counts intensity for every single nm change in wavelength but with the sample it counts intensity for every 5 nm changes. Now by using the system response txt file, how can i interpolate the value of intensity of intermediate wavelength of with sample data sets. Here is the text files, PLFILE.txt is the system response or without sample and SAMFILE.txt is with sample. Thanks in advance.

 採用された回答

Star Strider
Star Strider 2018 年 1 月 7 日

0 投票

I would use the interp1 (link) function.
I selected a subset of your data to demonstrate the approach. It will work on all your data. The plot demonstrates the result:
Set1 = [1400 0.826454201
1401 0.827785549
1402 0.829116897
1403 0.830448245
1404 0.831779593
1405 0.833110942
1406 0.83444229
1407 0.835773638
1408 0.837104986
1409 0.838436334
1410 0.839767682
1411 0.841099031
1412 0.842481598
1413 0.843841199
1414 0.845188873
1415 0.846524901
1416 0.84784956
1417 0.849163132
1418 0.850465897
1419 0.851758134
1420 0.853040123];
Set2 = [1400.0000 4593
1405.0000 4588
1410.0000 4594
1415.0000 4572
1420.0000 4577];
Set2i = interp1(Set2(:,1), Set2(:,2), Set1(:,1), 'spline', 'extrap');
figure(1)
subplot(2,1,1)
plot(Set1(:,1), Set1(:,2), '.b')
legend('Set_1', 'Location','E')
subplot(2,1,2)
plot(Set2(:,1), Set2(:,2), 'pg')
hold on
plot(Set1(:,1), Set2i, '.r')
hold off
legend('Set_2 (Original)', 'Set_2 (Interpolated)', 'Location','SW')

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Interpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by