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

27 次查看(过去 30 天)
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

采纳的回答

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

请先登录,再进行评论。

更多回答(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