Removal of background continuum emission from a LIBS spectra

Hello, I have a LIBS raw spectra that contain both the background continuum emission and the atomic and ionic emission. 'The task is for me to remove the background continuum emission'. The approach I used for the first data I collected is not working for the new data I am working on.
What I did on the first data was just by smoothing with sgolay filter and then substracted the smoothed data from the original (raw) data but this approach seems not to work on my current data.
Is there anyone who has a more defined approach to solving this please?. I have included the image of what the spectra look like. Thanks

 Réponse acceptée

Star Strider
Star Strider le 10 Mar 2023
It would help to have the data, and a description of the desired result, since I do not understand ‘background continuum emmission’ or what it does to the signal.
One option could be to use the islocalmin function with the appropriate 'MinProminence' value, fit that result using polyfit (and polyval), and then subtract that from the original signal to ptroduce a more consistent baseline. That approach has worked in other applications for me.

6 commentaires

Thank you for response. Just to provide a bit more clarification: What I wanted to achieve is to extract the atomic and ionic peaks only by removing the background effect.
I have no idea what that means (although I might understand it with a bit of explanation), since I have no idea what your signal is.
This illustrates the general approach —
N = 100;
x = linspace(200, 450, N);
s = randn(1,N) + (rand(1,N)>0.9)*5 - (x - mean(x)).^2/1E3 + 20; % Create Signal
figure
plot(x, s)
title('Original')
Lv = islocalmin(s, 'MinProminence',0.5);
figure
plot(x, s)
hold on
plot(x(Lv), s(Lv), 'r+')
hold off
title('Original With Identified Baseline Minima')
Order = 2; % Change Order To Provide The Best Result
[p,mu,S] = polyfit(x(Lv), s(Lv), Order);
v = polyval(p, x, mu, S);
sc = s - v; % Correct Signal Baseline
figure
plot(x, sc)
title('Original With Corrected Baseline')
.
Thank you so much. I have tried using the code you shared but the islocalmin function is returning me an incompaitble array. Response like 'Array indices must be positive integers or logical values'. I have attached my data as a file to this, perhaps you can be able to help me figure out the problem.
This is an extremely difficult signal to work with. I would just go with the bandpass filtered version (that removes the baseline drift and some of the high-frequency noise) and leave it at that, although highpass filtering could also work. Using detrend on the filtered signal could be an option, however removing a polynomial fit to the minima does not appear to add much benefit. I leave that to you, since I am not certain what sort of result you want.
M1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1320410/Data.xlsx');
M1 = M1.';
M1 = fillmissing(M1,'nearest');
x = M1(:,1);
s = M1(:,2);
figure
plot(x, s)
title('Original')
Ts = mean(diff(x))
Ts = 0.0617
Tsd = std(diff(x))
Tsd = 0.0037
Fs = 1/Ts
Fs = 16.2116
Fsr = floor(Fs);
[sr,xr] = resample(s,x,Fsr);
Fnr = Fsr/2;
L = size(sr,1);
NFFT = 2^(nextpow2(L)+5);
FTsr = fft((sr-mean(sr)).*hann(L), NFFT);
Fv = linspace(0, 1, NFFT/2+1)*Fnr;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTsr(Iv)*2))
grid
xlim([0 0.1])
srf = bandpass(sr, [0.05 0.5], Fsr, 'ImpulseResponse','iir');
figure
plot(xr, srf)
title('Original Resampled & Filtered')
srfdt = detrend(srf, 5);
figure
plot(xr, srfdt)
title('Original Resampled & Filtered & Detrended')
Lv = islocalmin(srf, 'MinProminence',250);
pts = nnz(Lv)
pts = 20
figure
plot(xr, srf)
hold on
plot(xr(Lv), srf(Lv), 'r+')
hold off
title('Original With Identified Baseline Minima')
Order = fix(pts/2); % Change Order To Provide The Best Result
[p,mu,S] = polyfit(xr(Lv), srf(Lv), Order);
v = polyval(p, xr, mu, S);
srfc = srf - v; % Correct Signal Baseline
figure
plot(xr, srfc)
ylim([-500 1500])
title('Original With Corrected Baseline')
.
Thanks for coming through.
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by