Impulse response of a given system 

Aim:-  To write a MATLAB program to evaluate the impulse response of the system .  

Objective:-  To write a MATLAB program to evaluate the impulse response of the system  using MATlab.

EQUIPMENTS:  

Operating System - Windows XP

Constructor - Simulator

Software - CCStudio 3 & MATLAB 7.5

The Difference equation is given as

                                                       y(n) = x(n)+0.5x(n-1)+0.85x(n-2)+y(n-1)+y(n-2)  

Program:-

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);

% figure(1);

plot(t,h);  

title('plot of impulse response');

ylabel('amplitude');  

xlabel('time index----->N');

subplot(2,1,2);

% figure(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 respons 4  

1.0000  

1.5000  

3.3500  

4.8500  

Graph

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:  The impulse  response of given Differential  equation is obtained. Hence the theory and practical value are proved

 

Discussion /Viva questions:-

1)  Differentiate between linear and circular convolution.  

2)  Determine the unit step response of the linear time invariant system with impulse  

                                      response  h(n)=a n u(n) a<1&-a<1

3)  Determine the range of values of the parameter a for which linear time invariant system with impulse response    h(n)=a n u(n)     is stable.  

4)  Consider the special case of a finite duration sequence given as X(n)={2 4 0 3}, resolve the sequence x(n) into a sum of weighted sequences.

5) . Describe impulse response of a function?

6) . Where to use command filter or impz, and what is the difference between these two?