Butterworth Notch Filters

67 views (last 30 days)
Devin
Devin on 15 Apr 2011
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
karthik keya kumar
karthik keya kumar on 17 Oct 2020
then how to get order of filter from this

Sign in to comment.

Accepted Answer

Rob Graessle
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);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!