zmalqp
zmalqp

Reputation: 1

How can i get coefficients of filter in matlab

I designed band-pass filter 'elliptic' using design function in matlab, how can i get the coefficients of this filter [A, B]. I see Hd file in workspace containing some files(scalevalus, states sosMatrix).

Upvotes: 0

Views: 4106

Answers (1)

yoh.lej
yoh.lej

Reputation: 1104

You can use coeffs of the DSP System Toolbox:

s = coeffs(Hd);
s.Numerator

EDIT: You are actually using cascaded second order filters, so it is not defined with numerator B and denominator A, but the coefficients of the cascaded sections are in the Hd.sosMatrix:

fvtool:

sos is a K-by-6 matrix, where the number of sections, K, must be greater than or equal to 2. If the number of sections is less than 2, fvtool considers the input to be a numerator vector. Each row of sos corresponds to the coefficients of a second order (biquad) filter. The ith row of the sos matrix corresponds to [bi(1) bi(2) bi(3) ai(1) ai(2) ai(3)].

So if you really need an equivalent classic filter with coefficients [A,B] your best option is to use sos2tf, but this is only an approximation:

[B,A] = sos2tf(Hd.sosMatrix,Hd.ScaleValues);

Upvotes: 1

Related Questions