Matlab DSP question!

Discussion in 'Programmer's Corner' started by link180, May 4, 2009.

  1. link180

    Thread Starter New Member

    May 4, 2009
    1
    0
    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.

    please help!

    thanks

    link
     
  2. whzahp

    New Member

    May 3, 2009
    4
    0
    %Definition of variables
    %num_coeffs :Numarator co-efficients of H(z)=Y(z)/X(z) given in descending powers of z
    %den_coeffs :Denominator 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)');
     
Loading...