Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Example: Given the following difference equation: a. b. c.

y (n) y (n 1) + 0.9 y (n 2) = x(n)


Calculate and plot the impulse response Calculate and plot the unit step response Is the system specified by h(n) stable?

Solution:

%Impulse response of y(n)-y(n-1)+0.9y(n-2)=x(n)difference equation b=[1]; a=[1,-1,0.9]; n=[-20:120]; x=[(n-0)==0]; h=filter(b,a,x); stem(n,h); title('Impulse response');xlabel('n');ylabel('h(n)');

ECE 308-1

b.
%unit response of y(n)-y(n-1)+0.9y(n-2)=x(n)difference equation b=[1]; a=[1,-1,0.9]; n=[-20:120];x=[(n-0)>=0]; h=filter(b,a,x); stem(n,h); title('Unit response'); xlabel('n'); ylabel('h(n)');

c.

The impulse response of h(n) is getting zero for n>120. To find system is stable, we need to calculate Therefore

h( n)

>>sum(abs(h)) ans = 14.8785


which implies that system is stable.

ECE 308-2

You might also like