Should ztrans Work Better when Using heaviside() ?
2 views (last 30 days)
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
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
2. Introduce symbolic sampling period, still works fine.
3. Multiply the simple case by heaviside[n], which shouldn't have any material effect because heaviside = 1
It has no material effect, but we can see that ztrans is accounting for the possibility that heaviside might not be 1, so it appears to be using the general rule
y[n] = f[n]*heaviside[n] = f*heaviside*kroneckerDelta[n] + f[n]*u[n-1]
where u[n] is the discrete-time unit step. The z-transform is then
Y(z) = f*heaviside + 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*heaviside - f)*kroneckerDelta(n)
Y(z) = Z(f[n]) - f*h
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.
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.