how to apply Sgolayfilter
Afficher commentaires plus anciens
hi, i have a noisy signal with sampling frequency of 2*10^5 and nominal frequency of 50 hz. i want to apply sgolay filter to smooth the wave, if i choose frame size 4900, it takes to long for running the program. could you explain me how i should choose the filter order and frame size?thank you un advance
Réponses (2)
Image Analyst
le 19 Oct 2014
0 votes
That seems like an awfully wide window size. How long does it take? What is the order of the polynomial you are using? It shouldn't be more than 5 or so. Most of the time I use 2 or 3. You'll probably get garbage if you use orders like 20 or 30 or more. How many elements are in your signal? Sampling a 50 Hz signal 200,000 times per second seems unnecessarily rapid unless you are really trying to investigate the noise itself rather than just wanting a smoothed signal. Unless the signal is extraordinarily noisy, you should be able to get by with a signal around 11 - 41 elements I would think. You can post your data file and m-file if you want us to look at it further.
2 commentaires
maryam
le 19 Oct 2014
Image Analyst
le 19 Oct 2014
Looks more like you just need to delete repeats and outliers than to smooth. See this: http://www.mathworks.com/matlabcentral/fileexchange/3961-deleteoutliers

x = rand(1, 2e5);
tic; y = sgolayfilt(x, 3, 4901); toc
tic; y = fSGolayFilt(x, 3, 4901); toc
Elapsed time is 17.458964 seconds.
Elapsed time is 0.719584 seconds.
Matlab 2011b, Win7/64, Core2Duo
But consider Image Analyst's comment. This is an really unusual widow size. But even for shorter windows, the mentioned MEX file helps to save time.
Catégories
En savoir plus sur Smoothing and Denoising dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!