Base line removal for Raman input
Show older comments
i run this code, read txt file , get plot about the Raman spectrum, second about the baseline removal.
The first plot is perfect , at the second plot the variable p doesn't get a value, only Nah. i don't know why
Code:
T1 = readtable('20ul_nicotine_10mg_per_ml_20ul_AgNPs_45sx1.txt','PreserveVariableNames',true);
x = T1{:,4};
y = T1{:,8};
figure
plot(x,y)
grid
TF = islocalmin(y, 'MinProminence',15, 'MinSeparation',60);
hold on
plot(x(TF), y(TF), '.r')
hold off
xlim([175 3303])
legend('Signal','Points Used To Identify Baseline Trend', 'Location','best')
title('XRD Spectrum With Identified Baseline')
p = polyfit(x(TF), y(TF),4);
BL = polyval(p, x);
figure
plot(x, y-BL)
%xlim([175 3303])
grid
title('Baseline-Detrended Signal')
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics 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!
