Trouble with plotting z-transform using residue

Hi,
I am trying to use residue function to compute the inverse z transform. I have a 2nd order X(z). I am tring to use a for loop to multiply by z^n-1 for corresponding n. I have two poles and two zeros so I am assuming the inverse z transform would be the sum of residues of all the poles of z^n-1X(z).
I have attached my code with comment inserted:I am not sure why I am getting zero for all the n values.I am trying to compute x(n) for values for n>0.
window length=500;
xn=1:windowlength;
zn=1:windowlength;
num=[1 2 2]
denom=[1 1 3]
for j=1:windowlength
zn=zeros(1:length(zn))
zn(j)=1 % setting z^n-1 for each loop teration
numf=conv(num,zn); %multiplying zn with num
r=residue(num,denom);
xn(j)=sum(r);
end;

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 1 Oct 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!