Reputation: 37
I'm trying to find the impulse response of a filter expressed by a difference equation as below:
y[n] - y[n-1] + 0.9*y[n-2] = x[n] - x[n-2]
I want to use Z-transform in order to solve he equation. I use this code in Matlab:
syms y(n) z
eq = y(n) - y(n - 1) - 0.9*y(n - 2) - impulse_me(n) + impulse_me(n - 2);
Zeq = ztrans(eq, n, z);
and I have declared impulse_me function as below:
function [ y ] = impulse_me( n )
y = (n==0);
end
but when I run the code the result is:
Zeq =
ztrans(y(n) - (9*y(n - 2))/10 - y(n - 1) - 2 == y(n) - (9*y(n - 2))/10 - y(n - 1), n, z)
can anybody help me with the problem?
Upvotes: 2
Views: 1646