adaptive savitzky golay to find optimum order and window size
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi
I need to apply adaptive SG filter to my data to find the optimum order and window size. I used below code
to generate smoothed signal from the noise one , I need to find SG order and window size that preserve the
peaks in the signal and reduce the signal fluctuation between them .
for order =(0:1:9) ;
for framelen =(1:2:51);
x=-AV;
lx = 20;
sgf = sgolayfilt(x,order,framelen);
plot(sgf);
hold on;
end
end
0 comentarios
Respuestas (1)
Image Analyst
el 10 de Mayo de 2017
Find the peaks first with findpeaks(). Then replace those locations with the original signal in small windows around the peaks. So make a logical vector that's true where you want original spikes and false where you want the SG filtered signal, then do
sgf(peaksMask) = x(peaksMask);
4 comentarios
Jan
el 11 de Mayo de 2017
@sarmand m: All orders and window sizes do reduce the noise and preserve the peaks in a certain degree. You are looking for the "optimal" order and window size, but you did not specify how this is measured. How do you decide which filter parameters are "better"? There is no magic set of parameters which leave the peaks untouched and removes all noise. You cannot even know if the exact peak height is caused by noise.
Do you see the problem? To find the "best" parameters, you have to start with defining what "good" is mathematically.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!