I am experiencing difficulty obtaining a Real result when performing the InverseZTransform function. As an example, I want to find a closed form expression for the output of a simple exponential smoothing filter to a sinusoidal input. I start by finding the z-transforms of the filter impulse response and the sinusoid:
ZTransform[a (1 - a)^n, n, z]
(a z)/(-1 + a + z)
ZTransform[Sin[w n], n, z]
(z Sin[w])/(1 + z^2 - 2 z Cos[w])
Then I take the inverse z-transform of their product:
InverseZTransform[((a z)/(-1 + a + z)) (z Sin[w])/( 1 + z^2 - 2 z Cos[w]), z, n, Assumptions -> { a \[Element] Reals, w \[Element] Reals}]
-((a E^(-I (-1 + n) w) (-1 + a + E^(I w) + (1 - a)^n E^(I n w) - (1 - a)^n a E^(I n w) + E^(2 I (1 + n) w) - a E^(2 I (1 + n) w) -
E^(I (1 + 2 n) w) - (1 - a)^n E^(2 I w + I n w) + (1 - a)^n a E^(2 I w + I n w)) Sin[w] UnitStep[-1 + n])/((-1 + E^(I w)) (1 + E^(I w))
(-1 + a + E^(I w)) (1 - E^(I w) + a E^(I w))))
Using FullSimplify[ComplexExpand[ ] ] to simplify this produces an expression that still contains complex exponentials:
(a E^(-I (-1 + n) w) Sin[w] (a (-1 + E^(2 I (1 + n) w)) - (-1 + E^(I w)) (1 + E^(I (w + 2 n w))) +
2 I (1 - a)^(1 + n) E^(I (1 + n) w) Sin[w]) UnitStep[-1 + n])/((-1 + a + E^(I w)) (1 + (-1 + a) E^(I w)) (-1 + E^(2 I w)))
This result is obtained even if I include the option {n [Element] Reals, a [Element] Reals, w [Element] Reals}
I know the result must be Real but I can't seem to nudge Mathematica to produce a result in that form. Any suggestions how to accomplish this will be most welcome.
KM