Matlab is not giving the correct z transform of - (n*a^n)*u[- n - 1];
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Torsten
il 30 Gen 2024
syms n z a
y = n*a^n;
yz = ztrans(y, n, z)
Now multiply numerator and denominator by z^-2.
Risposta accettata
VBBV
il 30 Gen 2024
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 Commenti
VBBV
il 30 Gen 2024
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
Più risposte (1)
Paul
il 30 Gen 2024
Modificato: Paul
il 31 Gen 2024
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 Commenti
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!