Given the difference equation as 𝑦[𝑛]=5𝑥[𝑛]+5𝑦[𝑛−2] and 𝑥[𝑛]=cos(𝜋𝑛). I would like to obtain the transfer function h[n]. How is that possible manually and on Matlab?

Manually it should be very easy yet I am stuck with a trivial part. I considered H(z) = Y(z)/X(z) then I preform z-inverse. The issue is that I am stuck with Y(z) expression in my H(z) is that okay?

On Matlab I have done the following code:

syms n x(n) y(n)
x(n) = cos(pi*n);
y(n)=5*x(n) + 5*y(n-2);

H = ztrans(y)/ztrans(x);
h = iztrans(H);

Which result in a very lengthy outcome which made me doubt whether it's correct or not.

EDIT: the range given is 0:n:20

What am I doing wrong and how can I get to the answer

  • $\begingroup$ without looking at what you did: $y$ depends on past values of $y$, so this is a recursive filter, and thus probably an IIR filter. Also, if you write "h[n]", you typically mean the (discrete) impulse response, NOT the transfer function! You nowhere mention the step response in your question but your title – which makes me wonder: $$\,$$What do you *really* want to find? $$\,$$· The step response (per your title), or $$\,$$· the transfer function (per your first sentence), or$$\,$$· the impulse response (per your notation)? These are three different things! $\endgroup$ – Marcus Müller Mar 21 at 18:09
  • $\begingroup$ I pretty much appreciate your response. Pardon me as I have a very small knowledge about the topic plus all the terms just over crossed while typing. Basically I want to find h[n] : discrete impulse response $\endgroup$ – DarkProfessor Mar 21 at 20:18
  • $\begingroup$ but that's an IIR (infinite impulse response) system – hence, your $h[n]$ never ends... $\endgroup$ – Marcus Müller Mar 21 at 20:26
  • $\begingroup$ What if I have a range say 0 : n : 20 ? Will the h[n] expressing be achievable then ? $\endgroup$ – DarkProfessor Mar 21 at 20:39
  • $\begingroup$ You're in no position to define that range, unless you're willing to cut off after that, and then you get some system, but not the same as described by your initial equation! $\endgroup$ – Marcus Müller Mar 21 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.