Lab 9

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

LAB # 9: Realization of FIR and IIR systems using different

structures.
Introduction
A structural representation using interconnected basic building blocks is the first step in the
hardware or software implementation of an LTI digital filter. The structural representation
provides the relations betweensome pertinent internal variables with the input and the output
that in turn provide the keys to the implementation. This lab exercise considers the development
of structural representations of causal IIR and FIR transfer functions in the form of block
diagrams.
Code:
% Program P9_1
% Conversion of a rational transfer function to its factored form
num = input('Numerator coefficient vector = ');
den = input('Denominator coefficient vector = ');
[A, B] = eqtflength(num, den);
[z,p,k] = tf2zp(A, B);
sos = zp2sos(z,p,k)
%[2 10 23 34 31 16 4]
%[1]
Result:
>> lab9dsppart1
Numerator coefficient vector = 7
Denominator coefficient vector = 8

sos =

0.8750 0 0 1.0000 0 0

>>
Code q,2:
7% Program P9_1
% Conversion of a rational transfer function to its factored form
num = input('Numerator coefficient vector = ');
den = input('Denominator coefficient vector = ');
[A, B] = eqtflength(num, den);
[z,p,k] = tf2zp(A, B);
sos = zp2sos(z,p,k)

%[6 31 74 102 74 31 6]
% [1]

Result:
>> lab9dsppart1
Numerator coefficient vector = 7
Denominator coefficient vector = 8

sos =

0.8750 0 0 1.0000 0 0

>> lab9dspq2
Numerator coefficient vector = 6
Denominator coefficient vector = 5

sos =

1.2000 0 0 1.0000 0 0

>>
Q#3 Code:
% Program P9_1
% Conversion of a rational transfer function to its factored form
num = input('Numerator coefficient vector = ');
den = input('Denominator coefficient vector = ');
[A, B] = eqtflength(num, den);
[z,p,k] = tf2zp(A, B);
sos = zp2sos(z,p,k)

%Numerator coefficient vector = [3 8 12 7 2 -2]


%Denominator coefficient vector = [16 24 24 14 5 1]
Result:
>> lab9dspq3
Numerator coefficient vector = 9
Denominator coefficient vector = 3

sos =

3 0 0 1 0 0
Q#4
Code:
% Program P9_1
% Conversion of a rational transfer function to its factored form
num = input('Numerator coefficient vector = ');
den = input('Denominator coefficient vector = ');
[A, B] = eqtflength(num, den);
[z,p,k] = tf2zp(A, B);
sos = zp2sos(z,p,k)
%[2 10 23 34 31 16 4]
%[36 78 87 59 26 7 1]
Result:
Numerator coefficient vector = [2 10 23 34 31 16 4]
Denominator coefficient vector = [36 78 87 59 26 7 1]

sos =
0.0556 0.1667 0.1111 1.0000 0.5000 0.2500
1.0000 1.0000 2.0000 1.0000 1.0000 0.3333
1.0000 1.0000 0.5000 1.0000 0.6667 0.3333
Q#5 Code:
% Program P9_2
% Parallel Form Realizations of an IIR Transfer Function
num = input('Numerator coefficient vector = ');
den = input('Denominator coefficient vector = ');
[r1,p1,k1] = residuez(num,den);
[r2,p2,k2] = residuez(num,den);
disp('Parallel Form I')
disp('Residues are');
disp(r1);
disp('Poles are at');
disp(p1); disp('Constant value');
disp(k1);
disp('Parallel Form II')
disp('Residues are');disp(r2);
disp('Poles are at');disp(p2);
disp('Constant value');
disp(k2);

Result:
lab9task5
Numerator coefficient vector = [2 10 23 34 31 16 4]
Denominator coefficient vector = [36 78 87 59 26 7 1]
Parallel Form I
Residues are
-0.5556 - 2.2785i
-0.5556 + 2.2785i
-0.5952 - 0.7561i
-0.5952 + 0.7561i
-0.8214 + 4.3920i
-0.8214 - 4.3920i

Poles are at
-0.3333 + 0.4714i
-0.3333 - 0.4714i
-0.5000 + 0.2887i
-0.5000 - 0.2887i
-0.2500 + 0.4330i
-0.2500 - 0.4330i

Constant value
4

Parallel Form II
Residues are
-0.5556 - 2.2785i
-0.5556 + 2.2785i
-0.5952 - 0.7561i
-0.5952 + 0.7561i
-0.8214 + 4.3920i
-0.8214 - 4.3920i

Poles are at
-0.3333 + 0.4714i
-0.3333 - 0.4714i
-0.5000 + 0.2887i
-0.5000 - 0.2887i
-0.2500 + 0.4330i
-0.2500 - 0.4330i

Constant value
4

>>
Q#6 Code:
% Program P9_3
% Gray-Markel Cascaded Lattice Structure
% k is the lattice parameter vector
% alpha is the vector of feedforward multipliers format long
% Read in the transfer function coefficients
num = input('Numerator coefficient vector = ');
den = input('Denominator coefficient vector = ');
N = length(den)-1; % Order of denominator polynomial k = ones(1,N);
a1 = den/den(1);
alpha = num(N+1:-1:1)/den(1);
for ii = N:-1:1,
alpha(N+2-ii:N+1) = alpha(N+2-ii:N+1)-alpha(N-ii+1)*a1(2:ii+1); k(ii) =
a1(ii+1);
a1(1:ii+1) = (a1(1:ii+1)-k(ii)*a1(ii+1:-1:1))/(1-k(ii)*k(ii)); end
disp('Lattice parameters are');
disp(k)
disp('Feedforward multipliers are');disp(alpha)
Result:
>> lqb9dsp
Numerator coefficient vector = [2 10 23 34 31 16 4]
Denominator coefficient vector = [36 78 87 59 26 7 1]
Lattice parameters are
0.8109 0.7711 0.5922 0.3717 0.1344 0.0278

Feedforward multipliers are


0.1111 0.2037 0.1520 -0.0474 -0.0146 0.0235 -0.0111

You might also like