Discussion:
Cascade IIR Filters
(too old to reply)
Anju
2004-04-20 20:10:00 UTC
Permalink
Hi! Ken,
here's what am trying to do..i should be able to generate the
coefficients of a Nth order filter just by using a 2nd order and/or a
1st order...is it possible??..

Anju
Hi! Abhay,
Thanks for ur reply.I tried that already but it would
defeat the very purpose of cascading filters because u need to
get
the direct coefficients first then use zp2sos to get the
cascade
form...what am trying to do is for eg. if i need the
coefficients
of
a 4th order butterworth filter, i should be able to cascade 2
2nd
order filters...is it possible???....
Anju
hi! All,
i would like some info on implementing cascade form
IIR
filters...does matlab support it???...as far as i can
understand
butter,cheby1,cheby2,bessel,ellip generate
coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi
You might like to use commands like tf2zp and zp2sos to
get it
into
cascaded form IIR.
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)
A. Kumar
I do not see how this defeats the very purpose of cascading
filters. Perhaps
you need to explain what is the very purpose of cascading filters.
I always
understood that one designs the filter for the response you want
and onlt
then does one restructures it for the implementation... as Abhay
has
suggested.
Anju
2004-04-20 16:24:15 UTC
Permalink
Hi! Abhay,
Thanks for ur reply.I tried that already but it would
defeat the very purpose of cascading filters because u need to get
the direct coefficients first then use zp2sos to get the cascade
form...what am trying to do is for eg. if i need the coefficients of
a 4th order butterworth filter, i should be able to cascade 2 2nd
order filters...is it possible???....

Anju
hi! All,
i would like some info on implementing cascade form IIR
filters...does matlab support it???...as far as i can
understand
butter,cheby1,cheby2,bessel,ellip generate coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi
You might like to use commands like tf2zp and zp2sos to get it into
cascaded form IIR.
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)
A. Kumar
Ken Davis
2004-04-20 16:48:01 UTC
Permalink
Hi! Abhay,
Thanks for ur reply.I tried that already but it would
defeat the very purpose of cascading filters because u need to get
the direct coefficients first then use zp2sos to get the cascade
form...what am trying to do is for eg. if i need the coefficients of
a 4th order butterworth filter, i should be able to cascade 2 2nd
order filters...is it possible???....
Anju
hi! All,
i would like some info on implementing cascade form IIR
filters...does matlab support it???...as far as i can
understand
butter,cheby1,cheby2,bessel,ellip generate coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi
You might like to use commands like tf2zp and zp2sos to get it into
cascaded form IIR.
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)
A. Kumar
I do not see how this defeats the very purpose of cascading filters. Perhaps
you need to explain what is the very purpose of cascading filters. I always
understood that one designs the filter for the response you want and onlt
then does one restructures it for the implementation... as Abhay has
suggested.
Abhay Kumar
2004-04-20 15:04:15 UTC
Permalink
hi! All,
i would like some info on implementing cascade form IIR
filters...does matlab support it???...as far as i can understand
butter,cheby1,cheby2,bessel,ellip generate coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi

You might like to use commands like tf2zp and zp2sos to get it into
cascaded form IIR.
something like:
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)

A. Kumar
Ken Davis
2004-04-21 12:45:16 UTC
Permalink
Post by Anju
Hi! Ken,
here's what am trying to do..i should be able to generate the
coefficients of a Nth order filter just by using a 2nd order and/or a
1st order...is it possible??..
Anju
Hi! Abhay,
Thanks for ur reply.I tried that already but it would
defeat the very purpose of cascading filters because u need to
get
the direct coefficients first then use zp2sos to get the
cascade
form...what am trying to do is for eg. if i need the
coefficients
of
a 4th order butterworth filter, i should be able to cascade 2
2nd
order filters...is it possible???....
Anju
hi! All,
i would like some info on implementing cascade form
IIR
filters...does matlab support it???...as far as i can
understand
butter,cheby1,cheby2,bessel,ellip generate
coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi
You might like to use commands like tf2zp and zp2sos to
get it
into
cascaded form IIR.
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)
A. Kumar
I do not see how this defeats the very purpose of cascading
filters. Perhaps
you need to explain what is the very purpose of cascading filters.
I always
understood that one designs the filter for the response you want and onlt
then does one restructures it for the implementation... as Abhay has
suggested.
You haven't answered my question. You can design 2nd order sections and
cascade them (by multiplying their transfer functions) or you can break an
n-th order filter into second order sections. What else could you want?
Jason Schickler
2004-04-21 13:33:07 UTC
Permalink
Hey guys,

I think what you want to do is design the filter directly in ZPK and
then convert to SOS to avoid the numerical errors that come from
converting to the transfer function.

You should be able to do something like this:

[z,p,k] = butter(10, .4);

When you request 3 outputs from BUTTER it returns the zeros, poles
and gains and never converts to a transfer function which eliminates
a good amount of round-off error.

Now you can use zp2sos without fear.

[sos, g] = zp2sos(z,p,k);

And if you have a recent version of Signal Processing Toolbox, you
can pass this into an object and then to FVTool.

Hd = dfilt.df2sos(sos, g);
fvtool(Hd);

You can also see the improvement by passing the TF version of the
same butterworth filter to FVTool

[b, a] = butter(10, .4);
Hd2 = dfilt.df2(b, a);
fvtool(Hd, Hd2)

Jason
Post by Anju
Post by Anju
Hi! Ken,
here's what am trying to do..i should be able to
generate
Post by Anju
the
Post by Anju
coefficients of a Nth order filter just by using a 2nd order
and/or a
Post by Anju
1st order...is it possible??..
Anju
Hi! Abhay,
Thanks for ur reply.I tried that already but it would
defeat the very purpose of cascading filters because u
need to
Post by Anju
Post by Anju
get
the direct coefficients first then use zp2sos to get
the
Post by Anju
Post by Anju
cascade
form...what am trying to do is for eg. if i need the
coefficients
of
a 4th order butterworth filter, i should be able to
cascade 2
Post by Anju
Post by Anju
2nd
order filters...is it possible???....
Anju
hi! All,
i would like some info on implementing
cascade form
Post by Anju
Post by Anju
IIR
filters...does matlab support it???...as far
as i can
Post by Anju
Post by Anju
understand
butter,cheby1,cheby2,bessel,ellip generate
coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi
You might like to use commands like tf2zp and
zp2sos to
Post by Anju
Post by Anju
get it
into
cascaded form IIR.
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)
A. Kumar
I do not see how this defeats the very purpose of
cascading
Post by Anju
Post by Anju
filters. Perhaps
you need to explain what is the very purpose of cascading
filters.
Post by Anju
I always
understood that one designs the filter for the response
you
Post by Anju
want
Post by Anju
and onlt
then does one restructures it for the implementation... as
Abhay
Post by Anju
has
suggested.
You haven't answered my question. You can design 2nd order sections and
cascade them (by multiplying their transfer functions) or you can break an
n-th order filter into second order sections. What else could you want?
Abhishek
2010-11-16 04:34:05 UTC
Permalink
Hi all,

Is there any C implementation available for functions zp2sos or tf2sos?

Regards,
abhishek
Post by Jason Schickler
Hey guys,
I think what you want to do is design the filter directly in ZPK and
then convert to SOS to avoid the numerical errors that come from
converting to the transfer function.
[z,p,k] = butter(10, .4);
When you request 3 outputs from BUTTER it returns the zeros, poles
and gains and never converts to a transfer function which eliminates
a good amount of round-off error.
Now you can use zp2sos without fear.
[sos, g] = zp2sos(z,p,k);
And if you have a recent version of Signal Processing Toolbox, you
can pass this into an object and then to FVTool.
Hd = dfilt.df2sos(sos, g);
fvtool(Hd);
You can also see the improvement by passing the TF version of the
same butterworth filter to FVTool
[b, a] = butter(10, .4);
Hd2 = dfilt.df2(b, a);
fvtool(Hd, Hd2)
Jason
Post by Anju
Post by Anju
Hi! Ken,
here's what am trying to do..i should be able to
generate
Post by Anju
the
Post by Anju
coefficients of a Nth order filter just by using a 2nd order
and/or a
Post by Anju
1st order...is it possible??..
Anju
Hi! Abhay,
Thanks for ur reply.I tried that already but it would
defeat the very purpose of cascading filters because u
need to
Post by Anju
Post by Anju
get
the direct coefficients first then use zp2sos to get
the
Post by Anju
Post by Anju
cascade
form...what am trying to do is for eg. if i need the
coefficients
of
a 4th order butterworth filter, i should be able to
cascade 2
Post by Anju
Post by Anju
2nd
order filters...is it possible???....
Anju
hi! All,
i would like some info on implementing
cascade form
Post by Anju
Post by Anju
IIR
filters...does matlab support it???...as far
as i can
Post by Anju
Post by Anju
understand
butter,cheby1,cheby2,bessel,ellip generate
coefficients in the
direct
form...how do i implement the cascade form...
TIA
Anju
Hi
You might like to use commands like tf2zp and
zp2sos to
Post by Anju
Post by Anju
get it
into
cascaded form IIR.
[z,p,k]=tf2zp(b,a);
sys=zp2sos(z,p,k)
A. Kumar
I do not see how this defeats the very purpose of
cascading
Post by Anju
Post by Anju
filters. Perhaps
you need to explain what is the very purpose of cascading
filters.
Post by Anju
I always
understood that one designs the filter for the response
you
Post by Anju
want
Post by Anju
and onlt
then does one restructures it for the implementation... as
Abhay
Post by Anju
has
suggested.
You haven't answered my question. You can design 2nd order sections and
cascade them (by multiplying their transfer functions) or you can break an
n-th order filter into second order sections. What else could you want?
Rune Allnor
2010-11-16 06:08:40 UTC
Permalink
Post by Abhishek
Hi all,
Is there any C implementation available for functions zp2sos or tf2sos?
Not one you would want or need to use. These things are based on
polynomial root-finding algorithms, with all the mess that follows.

Instead, stop the design procedure when you have the filters on
sos form. There is no need to go any further - in fact, one does
not even *want* to go any further than that.

Rune

Loading...