Академический Документы
Профессиональный Документы
Культура Документы
LAB REPORT 05
6TH SEMESTER (SPRING 2019)
__________________________________
TAXILA
LAB No. 05
Objective:
To understand how to determine the transient and steady repose and how can check the
transient and steady response in MATLAB
Introduction:
Theory:
𝜋𝑛
Let the input signal be: 𝑥(𝑛) = 10 cos ( 4 ) 𝑢(𝑛). The system is initially at rest (i.e., it
is relaxed).
Code:
%part c
B=10.*[1-(1/sqrt(2))];
A=poly([a exp(j*pi/4) exp(-(j*pi/4))]);
Yzs=filter(B,A,[1,zeros(1,N)]);
figure;
stem(n,Yzs,'filled')
title('Zero-state response Y_z_s(n)')
%part d
[H,T]=impz(B,A);
figure;
subplot(211)
stem(T(1:N),H(1:N),'filled')
title('Impulse response of system')
%part e
subplot(212)
stem(n,Yzs)
hold on
stem(n,Yfr,'x')
legend('Y_z_s','Y_f_s')
title('Superposition of Y_r_s and Y_f_r')
For a=0.5
%part c
B=10.*[1-(1/sqrt(2))];
A=poly([a exp(j*pi/4) exp(-(j*pi/4))]);
Yzs=filter(B,A,[1,zeros(1,N)]);
figure;
stem(n,Yzs,'filled')
title('Zero-state response Y_z_s(n)')
%part e
subplot(212)
stem(n,Yzs)
hold on
stem(n,Yfr,'x')
legend('Y_z_s','Y_f_s')
title('Superposition of Y_r_s and Y_f_r')
Code
N=40; n=0:N;
%part b
%Ynr(natural response)
for i=1:N
Ynr(i)=2.5*(0.8)^i;
end
Ynr=[2.5*(0.8)^0,Ynr(1:end)]; %to add 0th index value
%part c
B=[1 -0.9877];
A=poly([0.8 0.9877+0.1564*j 0.9877-0.1564*j]);
Yzs=filter(B,A,[1,zeros(1,N)]);
figure;
stem(n,Yzs,'filled')
title('Zero-state response Y_z_s(n)')
%part d
[H,T]=impz(B,A);
figure;
subplot(211)
stem(T(1:N),H(1:N),'filled')
title('Impulse response of system')
%part e
subplot(212)
stem(n,Yzs)
hold on
stem(n,Yfr,'x')
legend('Y_z_s','Y_f_s')
title('Superposition of Y_r_s and Y_f_r')
4. What is the required condition for a system to sustain a steady-state output for 𝑛 ≥ 0?