Matlab is not giving the correct z transform of - (n*a^n)*u[- n - 1];
7 次查看(过去 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
1 个评论
Torsten
2024-1-30
syms n z a
y = n*a^n;
yz = ztrans(y, n, z)
Now multiply numerator and denominator by z^-2.
采纳的回答
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.
yz = ztrans(y, n,z)
simplify(yz)
2 个评论
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
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))
So the first thing we need to do is change that from the default
sympref('HeavisideAtOrigin',1);
heaviside(sym(0))
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.
Evaluate y for some values of n
[-3:3; y(-3:3)]
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!