Cannot deduce a transfer function! Help!

Hey everyone, I've tried creating a bandpass filter and finding it's transfer function but have had no luck. As you can see below, I tried making the filter and the line for 'd' runs just fine, but when I try to create the IIR filter 'HdIIR' from object d, it doesn't work. It has worked for other objects like 'd' I have created so I do not understand why this one doesn't work (albeit that my other objects used different parameters, but this should still be valid).
Once I get the filter to work, I would like to find the numerator and the denominator of the transfer function (S-domain preferable) of the filter but cannot find a method that will do so given either 'd' or 'HdIIR'.
Please help if you can!
-------------------------------------------------------------
clear all
close all
f_p1=40000; %Pass Frequency in Hz
f_p2=50000; %Stop Frequency in Hz
r_s=25; %Stopband Attenuation in dB
r_p=3; %Passband Ripple
n=10;
d = fdesign.bandpass('N,F3dB1,F3dB2,Ast1,Ap,Ast2',n,f_p1,f_p2,r_s,r_p,r_s,150e3);
HdIIR = design(d,'butter');
-----------------------------------------------------------------
??? Error using ==> fdesign.abstracttype.superdesign at 60
butter is an invalid design method.
Error in ==> fdesign.abstracttype.design at 11
varargout{1} = superdesign(this, varargin{:});
Error in ==> Demo at 13
HdIIR = design(d,'butter');

1 comentario

Alex
Alex el 21 de Nov. de 2011
Does anyone have any insight as to why this filter will not compile?

Iniciar sesión para comentar.

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 21 de Nov. de 2011
It appears that 'butter' is not a valid design method for the band-pass filter object.
Using designmethods on your filter design object, I got:
>> designmethods(d)
Design Methods for class fdesign.bandpass (N,F3dB1,F3dB2,Ast1,Ap,Ast2):
ellip
So 'ellip' seems to be the only available design method for your band-pass filter.

6 comentarios

Alex
Alex el 21 de Nov. de 2011
Thank you so much! Do you know by chance how I can deduce the Transfer Function from this?
Kaustubha Govind
Kaustubha Govind el 22 de Nov. de 2011
I don't know if I understand your question completely. Like I mentioned, you can use the 'ellip' method to find the filter coefficients (and therefore the transfer function).
Wayne King
Wayne King el 22 de Nov. de 2011
@Alex the IIR filters are in biquad form (cascaded second order sections) for robustness. If you want to see the coefficents are they would appear in a constant-coefficient linear difference equation, you can do:
Hd = design(d);
[B,A] = sos2tf(Hd.sosMatrix,Hd.ScaleValues);
Alex
Alex el 22 de Nov. de 2011
Hey Wayne!
So here is what I have:
d = fdesign.bandpass('N,F3dB1,F3dB2,Ast1,Ap,Ast2',n,f_p1,f_p2,r_s,r_p,r_s,150e3);
HdIIR = design(d,'ellip');
fvtool(HdIIR);
[B,A]=sos2tf(HdIIR.sosMatrix,HdIIR.ScaleValues)
---------------------------------------------------------------------
B =
Columns 1 through 6
0.0304 0.0726 0.1441 0.1566 0.1144 -0.0000
Columns 7 through 11
-0.1144 -0.1566 -0.1441 -0.0726 -0.0304
A =
Columns 1 through 6
1.0000 2.9945 8.0928 13.1008 18.9969 19.5845
Columns 7 through 11
18.1275 11.9235 7.0249 2.4738 0.7874
My question is, how do I put that in the form of a normal transfer function? Also, what domain does this assume? I checked the PZ plot from the fvtool and it shows 5 poles so the 6 column output threw me off unless the 6th column is a scalar.
Also, why do you use Hd ? What does that mean? I've noticed it in a lot of your responses!
Wayne King
Wayne King el 22 de Nov. de 2011
B are the numerator coefficients and A are the denominator coefficients. They are just the coefficients for the difference equation.
H is just a MATLAB convention for a handle to an object Hd is a filter object. You don't have to use H. You could use hd, or no h at all, I just use h when I want to remind myself that the output is a handle object.
Alex
Alex el 22 de Nov. de 2011
Hey Wayne, so what domain do I assume these coefficients correlate to? The S or Z domain?
Also, is there any convention on what the denominator coefficients correspond to? Example, is the numerator (A): s^5 + 2.9945s^4 + 8.0928s^3 + ... ?

Iniciar sesión para comentar.

Naz
Naz el 21 de Nov. de 2011
I always use
fdatool
it's pretty straight forward and you can see the result right away.

1 comentario

Naz
Naz el 21 de Nov. de 2011
And then you can export the coefficients into the workspace.

Iniciar sesión para comentar.

Preguntada:

el 19 de Nov. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by