# Matlab DSP question!

Joined May 4, 2009
1
Hey guys, long time reader first time poster!

got a small problem wondering if you guys could give me some tips

what i have is a LTI function

y[n]−1.8*cos(pi/16)*y[n−1]+0.81*y[n−2]=x[n]+0.5*x[n−1]

and i must plot h(n) in a defined range. I am new to matlab.

thanks

#### whzahp

Joined May 3, 2009
4
%Definition of variables
%num_coeffs :Numarator co-efficients of H(z)=Y(z)/X(z) given in descending powers of z
%den_coeffs enominator co-efficients of H(z)=Y(z)/X(z)in descending powers of z
%h :impulse respose h(n)
%h_length :length of h(n)required
h_length=input('Type in the length of impulse response:');
num_coeffs=input('Type in numerator coefficients:');
den_coeffs=input('Type in denominator coefficients:');

%inverse of rational Z-transform can be calculated by using impz(....) function
h=impz(num_coeffs,den_coeffs,h_length);
disp('The impulse response h(n) of the given system:');
disp(h');

%graphical display
n=0:h_length-1;
stem(n,h);
xlabel('Time index n');
ylabel('Amplitude');
title('h(n)');