Hi,
I have been trying to detrend raman spectra to bring the baseline down and reduce the affects of flouresence on analysis but when I use the code pasted below (with various adjustments based on the data), it definitely does not come out right at all. Trying to get a xlim of 0-800 with wavenumber (col1) on the x axis and intensity (col2, what I need corrected) on the y axis. I am relatively new to the program but if anyone has advice I would greatly appreciate! (also attatched a csv of one of the data sets in case that helps)
t = 0:300;dailyFluct = gallery('normaldata',size(t),2); sdata = cumsum(dailyFluct) + 20 + t/100;mean(sdata)figureplot(t,sdata);legend('Original Data','Location','northwest');xlabel('Time (days)');ylabel('Stock Price (dollars)');detrend_sdata = detrend(sdata);trend = sdata - detrend_sdata;mean(detrend_sdata)hold onplot(t,trend,':r')plot(t,detrend_sdata,'m')plot(t,zeros(size(t)),':k')legend('Original Data','Trend','Detrended Data',... 'Mean of Detrended Data','Location','northwest')xlabel('Time (days)'); ylabel('Stock Price (dollars)');
Best Answer