how to apply Sgolayfilter
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (2 件)
Image Analyst
2014 年 10 月 19 日
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 件のコメント
Image Analyst
2014 年 10 月 19 日
Looks more like you just need to delete repeats and outliers than to smooth. See this: http://www.mathworks.com/matlabcentral/fileexchange/3961-deleteoutliers
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178897/image.jpeg)
Jan
2014 年 10 月 19 日
編集済み: Jan
2014 年 10 月 19 日
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!