How to get the same filtered results from signal processing tool box using functions?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I have a question about filtering using MATLAB.
this is my data
readtable('data.csv')
And I wish to apply Savitzky-Golay filter using
sgolayfilt()
and get the same results from the same filtering in Signal Processing Toolbox (which are much smoother) .
However, when I tried, I get following results
filtered data using sgolayfilt(data, 3, 11) above
filtered data using signal processing tool box with all options 'auto'
I wish to know how toget below figure without using the toolbox.
Is there any way?
Thank you.
댓글 수: 1
Jan
2022년 8월 11일
편집: Jan
2022년 8월 11일
When I load your data, I get a different signal:
It looks like you have posted a cropped signal here. Then an exact omparsion is hard. Please post the data you are actually working with.
With sgolayfilt(data, 3, 51) the output looks like your screenshot (except for the cropping).
채택된 답변
Joe Vinciguerra
2022년 8월 23일
To see what the Signal Analyzer is doing under the hood to your data, click the "Analyzer" tab and select "Generate Function". Smoothing the data with the Savitzky-Golay method and otherwise "default" settings should produce the following output when you generate the function:
function y = preprocess(x)
% Preprocess input x
% This function expects an input vector x.
% Generated by MATLAB(R) 9.12 and Signal Processing Toolbox 9.0.
% Generated on: 23-Aug-2022 15:27:06
y = smoothdata(x,'sgolay');
You can see here that Signal Analyzer isn't directly calling the sgolayfilt function, but the smoothdata function with the sgolay method and default parameters (default degree = 2, window is determined heuristically). Check out the help page for more details.
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!