Butterworth Notch Filters
62 views (last 30 days)
Show older comments
Devin
on 15 Apr 2011
Commented: karthik keya kumar
on 17 Oct 2020
I'm designing a simple 60 Hz butterworth notch filter like this
[b a] = butter(n, [59 61]./(fs/2), 'stop');
When I use fvtool to look at the magnitude and phase response everything looks fine until I make n>=5, then both responses start to go all of the place. My magnitude response no longer looks like a notch.
My suspicion is that there is some roundoff error going on somewhere , but I'm unsure. Also, on my machine
>> eps
ans =
2.22044604925031e-16
Thanks for any help.
1 Comment
Accepted Answer
Rob Graessle
on 15 Apr 2011
For higher order filters (possibly starting as low as order 8), numerical problems due to roundoff errors may occur when forming the transfer function using the [b,a] syntax. You can avoid this by using the [z,p,k] syntax to design IIR filters. Here is an example:
[z p k] = butter(10, [59 61]./(fs/2), 'stop'); % 10th order filter
[sos,g]=zp2sos(z,p,k); % Convert to 2nd order sections form
h=dfilt.df2sos(sos,g); % Create filter object
fvtool(h);
0 Comments
More Answers (0)
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!