Displaying multiple line plots with different y-values on same baseline
6 views (last 30 days)
Show older comments
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:
0 Comments
Answers (1)
Mathieu NOE
on 6 Dec 2022
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 Comment
Mathieu NOE
on 6 Dec 2022
there are also tools for baseline removal but that may be overkill in your case
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!