Why does the magnitude response of my filter have noise in the low-frequency range in Signal Processing Toolbox 6.4 (R14SP3)?

2 views (last 30 days)
After designing a high-order filter (order 40) in FDATOOL, and exporting it to the workspace as "second-order sections" [SOS, G], I transform it into Transfer Function form using SOS2TF, and the magnitude response obtained is very different from what I designed in FDATOOL. Following is the code used to transform the data and display the resulting Magnitude response:
Fs=22050; % sample rate
%[B,A] = SOS2TF(SOS,G); doesn't work, but not the problem
[B,A] = sos2tf(SOS);
[H,W]=freqz(B,A,1000);
figure
plot(Fs*0.5*W/pi,10*log(abs(H)))
grid on;

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
Converting from "second order sections" (SOS) to "transfer function" form (TF) using SOS2TF when the filter order is large, results in a magnitude response different than expected in Signal Processing Toolbox, because the convolutions required to convert from second-order sections to transfer function introduce large roundoff errors.
To work around this issue, create an "SOS filter object". This preserves the second-order sections. It is possible to use filter-related functions such as FREQZ on the object itself. For example, if Hd is the filter object, the following code
[H,W]=freqz(Hd,1000);
figure
plot(Fs*0.5*W/pi,10*log(abs(H)))
grid on;
will display the filter's magnitude response as it was designed. It is also possible to filter with the object directly:
y=filter(Hd,x); % This filters using the second-order sections.

More Answers (0)

Tags

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!