Should ztrans Work Better when Using heaviside() ?
2 views (last 30 days)
Show older comments
Recently ran across peculiar behavior with ztrans.
Define some variables
syms n integer
syms T positive
Set sympref so that heaviside[n] is the discrete-time unit step
sympref('HeavisideAtOrigin',1);
Simple function to take the z-tranform of a signal and then the inverse z-transform, which should return the input signal
g = @(f) [ztrans(f) ; simplify(iztrans(ztrans(f)))];
1. Simple case, works as expected
g([cos(n) sin(n)])
2. Introduce symbolic sampling period, still works fine.
g([cos(T*n) sin(T*n)])
3. Multiply the simple case by heaviside[n], which shouldn't have any material effect because heaviside[0] = 1
g([cos(n) sin(n)]*heaviside(n))
It has no material effect, but we can see that ztrans is accounting for the possibility that heaviside[0] might not be 1, so it appears to be using the general rule
y[n] = f[n]*heaviside[n] = f[0]*heaviside[0]*kroneckerDelta[n] + f[n]*u[n-1]
where u[n] is the discrete-time unit step. The z-transform is then
Y(z) = f[0]*heaviside[0] + Z(f[n+1])/z
As an aside, it seems like it would be easier to solve by
y[n] = f[n]*heaviside[n] = f[n] + (f[0]*heaviside[0] - f[0])*kroneckerDelta(n)
Y(z) = Z(f[n]) - f[0]*h[0]
4. Now introduce the sampling period and heaviside. Based on 2 and 3 above, it would appear that the ztrans should be easily found as would the iztrans.
g([cos(T*n) sin(T*n)]*heaviside(n))
But, in neither case is the closed form expression returned for the z-transform. Oddly, iztrans returns the closed form expression for cos, but not for sin.
Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!