Displaying multiple line plots with different y-values on same baseline

I have IR data consiting of measured absorbance values and the corresponding wave number and I want to display them such that they all start from a certain baseline on the y axis (absorbance), despite all the individuals scans having differt starting points on the y-axis. So my question is if there is any implemented function that does the trick or if I the only choice is to add/subtract the right amount to the y-axis of each data set to force them to the same baseline.
What I have:
How I would like it:

回答 (1 件)

Mathieu NOE
Mathieu NOE 2022 年 12 月 6 日
hello
IMO, the simplest trick is to "normalize" your data by removing y(1) to each individual y array so that all lines start at y = 0;
if you want to start to another y value simply add this value
fs=100; % sampling frequency
samples = 50 ; % for each block of data for 1 frequency
dt = 1/fs;
t = (0:samples-1)*dt; % sample period
for ci = 1:10
y= ci*rand + (1+ 0.2*ci)*sin(2*pi*f1*t); % raw data
% y correction code
yy = y;
yy = yy - yy(1); % y aligned
subplot(2,1,1),plot(y); hold on
title('raw data')
subplot(2,1,2),plot(yy); hold on
title('corrected data')
end

1 件のコメント

Mathieu NOE
Mathieu NOE 2022 年 12 月 6 日
there are also tools for baseline removal but that may be overkill in your case

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

リリース

R2021b

質問済み:

2022 年 12 月 6 日

コメント済み:

2022 年 12 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by