DSP Task1
DSP Task1
COURSE TITLE
DIGITAL SIGINAL PROCESSING LAB
COURSE CODE
BECE301P
SLOT – L3+L4
DIGITAL ASSESSMENT – 1
SUBMITTED BY:
To use MATLAB to obtain the output of the LTI systems that are
represented using Linear Constant Coefficient Difference Equa on
(LCCDE).
CODE : (MATLAB)
CODE :
clc;
close all;
clear all;
n=0:50;
x=1*(n>=0)-1*(n>=7);
figure; subplot(2,1,1);
plot(n,x,"Color",'r','LineWidth',2); grid on;
xlabel('n');
tle('input signal');
B=1;
A=[1 -1/5];
y2=filter(B,A,x);
subplot(2,1,2);
stem(0:length(y2)-1,y2,'fill'); grid on;
xlabel('n');
tle('output using filter command');
GRAPHS:
CODE :
b=[1,0,0,0,0,0,0,0,-(0.9)^8];
a=[1,-0.9];
figure;
zplane(b,a);
tle('pole zero plot');
GRAPHS:
CODE :
[h,t]=impz(b,a,50);figure;
stem(t,h,'filled');
tle('impulse response');
GRAPHS:
CODE :
w=[-2.5:1/10:2.5];
[H,w]=freqz(b,a,w);
figure;
subplot(2,1,1)
plot(w/pi,20*log10(abs(H)));
xlabel('freq in pi units');
ylabel('magnitude');
tle('magnitude response');
grid on
subplot(2,1,2);
plot(w/pi,angle(H)/pi);
xlabel('freq in pi units');
ylabel('magnitude');
tle('phase response');
grid on
GRAPHS:
INFERENCE:
1. Iden fied and analyzed poles and zeros of the transfer func on
(H(z)).
2. Evaluated the magnitude response ∣H(z)∣ by using matlab func on
plot(w/pi,20*log10(abs(H))).
3. Determine the phase response ∠H(z) as a func on of frequency by
using the matlab func on plot(w/pi,angle(H)/pi).
4. Frequency response is done in matlab using the func on
[H,w]=freqz(a,b,w);
5. The given graph Plo ed the magnitude and phase responses with
chosen frequency range [-2.5:1/10:2.5].
6. The figure plots both magnitude and phase response of the given
func on f(z).