Matlab is not giving the correct z transform of - (n*a^n)*u[- n - 1];

조회 수: 27 (최근 30일)
juan
juan 2024년 1월 30일
댓글: juan 2024년 1월 31일
My code is:
syms n z a;
y = -(n*a*n)*heaviside(-n-1) ... heaviside is supposed to be the unit function but apparently it's not working.
yz = ztrans(y, n, z);
And the result I get everytime is 0... The correct answer must be (a*z^-1) / (1 - a*z^-1)^2
  댓글 수: 1
Torsten
Torsten 2024년 1월 30일
syms n z a
y = n*a^n;
yz = ztrans(y, n, z)
yz = 
Now multiply numerator and denominator by z^-2.

댓글을 달려면 로그인하십시오.

채택된 답변

VBBV
VBBV 2024년 1월 30일
syms n z a;
y = (n*a^n)*heaviside(n+1) %... heaviside is supposed to be the unit function but apparently it's not working.
y = 
yz = ztrans(y, n,z)
yz = 
simplify(yz)
ans = 
  댓글 수: 2
VBBV
VBBV 2024년 1월 30일
There is a typo error in the input function
y = (n*a^n)*heaviside(n+1) % equivalent expression
% ^ instead of power , you have a multiplier symbol
juan
juan 2024년 1월 31일
I can't believe I didn't notice that typo...

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Paul
Paul 2024년 1월 30일
편집: Paul 2024년 1월 31일
In addition to what @VBBV said about a typo in the defintion of y[n], there are two other fundamental problem that needs to be addressed.
The first problem is that, by default, the heaviside is not the discrete-time unit step for integer values of its argument, because for n = 0 with default sym preferences
sympref('default');
heaviside(sym(0))
ans = 
So the first thing we need to do is change that from the default
sympref('HeavisideAtOrigin',1);
heaviside(sym(0))
ans = 
1
Here's y, with the corrected typo
syms n z a
y(n) = -(n*a^n)*heaviside(-n-1) % heaviside is supposed to be the unit function but apparently it's not working.
y(n) = 
Evaluate y for some values of n
[-3:3; y(-3:3)]
ans = 
It's clear that y(n) = 0 for n >= 0.
However, the function ztrans is the unilateral z-transform and ignores all values of y for n < 0. So ztrans is basically computing the z-transform based only on n >=0, and in that range y(n) = 0 which is why ztrans returned zero. What you really need is the bilateral z-transform for a strictly left-sided (or non-causal) signal. You can get that using ztrans and one rule from a standard z-transform table.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by