Professional Documents
Culture Documents
Experiment No. 8 AIM:-To Write A MATLAB Program To Evaluate The Impulse Response of The
Experiment No. 8 AIM:-To Write A MATLAB Program To Evaluate The Impulse Response of The
THEORY:-
LTI Discrete time system is completely specified by its impulse response i.e.
knowing the impulse response we can compute the output of the system to any
arbitrary input. Let h[n] denotes the impulse response of the LTI discrete time
systems. Since discrete time system is time invariant, its response to [n-1] will be
h[n-1] .Likewise the response to [n+2] , [n-4] and [n-6] will be h[n+2], h[n-4] and
h[n-6] .
From the above result arbitrary input sequence x[n] can be expressed as a weighted
linear combination of delayed and advanced unit sample in the form k=+
X[n] = x[k][n-k]
k=-
where weight x[k] on the right hand side denotes specifically the k th sample value
of the sequence. The response of the LTI discrete time system to the sequence
As a result, the response y[n] of the discrete time system to x[n] will be given by
k=+
k=-
k=+
k=-
The above equation (1) and (2) is called the convolution sum of the sequences x[n]
and h[n] and represented compactly as y[n]=x[n] * h[n] Where the notation *
denotes the convolution sum.
Let us consider the first order system Y(n)=-a 1y(n-1)+b0 x(n) +b1 x(n-1)
This realization uses separate delays(memory) for both the input and output
samples and it is called as Direct form one structure.
A close approximation reveals that the two delay elements contain the same input
w(n) and hence the same output w(n-1).consequently these two elements can be
merged into one delay. In contrast to the direct form I structure , this new
realization
requires only one delay for auxiliary quantity w(n) ,and it is more efficient in terms
extensively.
PROGRAM:-
%To write a MATLAB program to evaluate the impulse response of the system
clc;
clear all;
close all;
% Difference equation of a second order system
% y(n) = x(n)+0.5x(n-1)+0.85x(n-2)+y(n-1)+y(n-2)
b=input('enter the coefficients of x(n),x(n-1)-----');
a=input('enter the coefficients of y(n),y(n-1)----');
N=input('enter the number of samples of imp response ');
[h,t]=impz(b,a,N);
subplot(2,1,1);
plot(t,h);
title('plot of impulse response');
ylabel('amplitude');
xlabel('time index----->N');
subplot(2,1,2);
stem(t,h);
title('plot of impulse response');
ylabel('amplitude');
xlabel('time index----->N');
disp(h);
grid on;
OUTPUT:
enter the coefficients of x(n),x(n-1)-----[1 0.5 0.85]
enter the coefficients of y(n),y(n-1)----[1,-1,-1]
enter the number of samples of imp response 4
1.0000
1.5000
3.3500
4.8500
CALCULATIONS:-
y(n) = x(n)+0.5x(n-1)+0.85x(n-2)+y(n-1)+y(n-2)
y(n) - y(n-1) - y(n-2) = x(n) + 0.5x(n-1) + 0.85x(n-2)
Taking Z transform on both sides,
Y(Z) - Z-1 Y(Z)- Z-2 Y(Z) = X(Z) + 0.5 Z-1 X(Z) + 0.85 Z-2 X(Z) Y(Z)[1 - Z-1 - Z-2]
= X(Z)[1 + 0.5 Z-1 + 0.85 Z-2 ]
But, H(Z) = Y(Z)/X(Z)
= [1 + 0.5 Z-1 + 0.85 Z-2 ]/ [1 - Z-1 - Z-2] By dividing we get
H(Z) = 1 + 1.5 Z-1 + 3.35 Z-2 + 4.85 Z-3
h(n) = [1 1.5 3.35 4.85]
RESULT: