0% found this document useful (0 votes)
6 views

Lab Sheet 3

Uploaded by

ashutoshjak88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lab Sheet 3

Uploaded by

ashutoshjak88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Nepal Engineering College

(Affiliated to POKHARA UNIVERSITY)


Changunarayan, Bhaktapur

Report On
Labe 3 Poles and Zeros

SUBMITTED BY: SUBMITTED TO:


Name: Ashutosh Acharya Rupesh D. Shrestha Sir
Roll No: 017-311
Department: Computer – 1
Group - A
1.Write a MATLAB program that plots the frequency and phase responses of
this digital filter.Hints: Find the system function, replace z with ejω then plot
ω Vs |H(ejω)| for magnitude plot and ωVs arg(H(ejω)) for phase plot. You can
also use the freqz MATLAB command.

1
Source Code
% lab 3 qno 1
b = [1 3 5];
a = [1 -0.5 0.8];
w = linspace(0,pi,10);
num = b(1) + b(2)*exp(-1i*w) + b(3)*exp(-1i*w*2);
den = a(1) + a(2)*exp(-1i*w) + a(3)*exp(-1i*w*2);
h = num./den;
subplot(211);
plot(w,abs(h),'*-');
subplot(212);
plot(w,phase(h),'*-');
title('CRN 017 311');
% or we can use
freqz(b,a);

Output:

1
2.Write a MATLAB program that calculates the poles and zeros of this digital
filter. Also plot the polesand zeros of this filter. Hint use the tf2zp & zplane
MATLAB command.

% lab 3 qno 2
clc; clear all;
b = [1 3 5];
a = [1 -0.5 0.8];
[z,p,k] = tf2zp(b,a)
"CRN 017-311"

Output:

Source Code:

% lab 3 qno 2
clc; clear all;
b = [1 3 5];
a = [1 -0.5 0.8];
zplane(b,a)

2
Output:

3. Write a MATLAB program that calculates the transfer function of the


digital filter that has thefollowing poles and zeros.Hint use the zp2tf
MATLAB command. Let the gain of this digital filter k = 1.{zk} = {+1, -1, 1 + i,
1 – i} and {pk} = {0.5, -0.5, 0.1 + 0.2i, 0.1 – 0.2i}

Source Code:
% lab 3 qno 3
clc; clear all;

3
z = [+1 -1 1+1i 1-1i].';
p = [0.5 -0.5 0.1+2i 0.1-2i].';
k = 1;
[b,a] = zp2tf(z,p,k)
"CRN 017-311"

Output:

4. Write a MATLAB program that plots the poles and zeros of the digital filter in
step 3.

Source Code:
% lab 3 qno 4
clc; clear all;
z = [+1 -1 1+1i 1-1i].';
p = [0.5 -0.5 0.1+2i 0.1-2i].';
k = 1;
[b,a] = zp2tf(z,p,k)
zplane(b,a)
"CRN 017-311"

Output:

4
5. Write a MATLAB program that calculates the poles and zeros of the
accumulator circuit whosedifference equation is1]-y[n][ y[n]nx.

Source Code:
% lab 3 q 5
clear; close all;
A = [1,-1]; % Coefficient of y[n]
B = 1; % Coefficient of x[n]
[z,p,k] = tf2zp(B,A)
zplane(z,p,k)

Output:

5
6. Write a MATLAB program that factorised the 4th order digital filter in step
3 into two cascaded 2ndorder digital filters.Hint use the zp2sos MATLAB
command.

6
Source Code:
% lab 3 qno 6
clc; clear all;
z = [+1 -1 1+1i 1-1i].';
p = [0.5 -0.5 0.1+2i 0.1-2i].';
k = 1;
[sos,g] = zp2sos(z,p,k)
"CRN 017-311"

Output:

7.Write a MATLAB program that calculates the partial fraction expansion of


system function obtainedin question no. 6. Hint use residuez MATLAB command.

Source Code:
% lab 3 qno 7
clc; clear all;
z = [+1 -1 1+1i 1-1i].';
p = [0.5 -0.5 0.1+2i 0.1-2i].';
k = 1;
[b,a] = zp2tf(z,p,k)
[r,p,x] = residuez(b,a)
"CRN 017-311"

7
Output:

8
8.Write a MATLAB program that calculates the partial fraction expansion of
system function obtainedin question no. 6. Hint use residuez MATLAB command.

Source Code:
% lab 3 qno 7
clc; clear all;
z = [+1 -1 1+1i 1-1i].';
p = [0.5 -0.5 0.1+2i 0.1-2i].';
k = 1;
[b,a] = zp2tf(z,p,k)
[r,p,x] = residuez(b,a)
"CRN 017-311"

Output:

9
10
11

You might also like