Post Reply 
Z-Transforms and Difference Equations?
05-13-2020, 03:40 AM
Post: #1
Z-Transforms and Difference Equations?
Z-Transforms are a great tool for dealing with difference equations, for example:

y(n) = 2*x(n) + 3*x(n-1) + 4*y(n) + 2*y(n-1)

However, I don't know how to type such a difference equation into the CAS. If I just try to define it as a function, the CAS warns me that I have a recursive definition, and goes into an infinite loop if I try to actually evaluate the z-transform.

Somewhat relatedly, I noticed that simply taking the Z Transform of the Dirac function does not lead to a simple "1", but instead to

sum(z^-n * Dirac(n),n,0,inf)

Which is just the direct application of the Z Transform, without any simplification.
Find all posts by this user
Quote this message in a reply
05-13-2020, 02:40 PM
Post: #2
RE: Z-Transforms and Difference Equations?
Yeah, I was never able to do that either. I think the ztrans() command can't handle difference equations, only expressions like e^(-kT), Heaviside(k-1), etc.

The inverse Z transform of 1 "invztrans(1,z,k)" returns the Kronecker delta, not Dirac, but "Kronecker(k)" doesn't seem to have any definition in the calculator. Maybe that's the reason it can't do the transform of impulse function?
Find all posts by this user
Quote this message in a reply
05-13-2020, 07:06 PM
Post: #3
RE: Z-Transforms and Difference Equations?
Playing around with it more, it seems what's missing here is the ability to declare, but not define, sequences. I.e. x and y in my example above are not functions (which would make x's definition above indeed recursive), but sequences.

If you could just tell the CAS that x and y are sequences, then

ztrans(2*x(n) + 3*x(n-1) + 4*y(n) + 2*y(n-1),n,z)

(omitting the "y(n) =" at the front) would, through the shift theorem, resolve to something like:

ztrans(2*x(n)) + z^(-1)*ztrans(3*x(n)) + ztrans(4*y(n)) + z^(-1)*ztrans(2*y(n))

And that would be very nice already.

Now, if you could also tell the CAS that, say, X is the z-transform of x, and Y is the z-transform of y, the expression could be further simplified to remove the "ztrans()"s.

I don't suppose that possible? This kind of thing, i.e. declaring relations between functions/sequences/other objects without defining those objects, so that they stay symbolic, is something that I've wondered about before. In another thread, I asked about how to tell the CAS that F(x) is the indefinite integral/antiderivative of f(x) without defining f(x) to a specific function.
Find all posts by this user
Quote this message in a reply
05-22-2020, 02:09 AM
Post: #4
RE: Z-Transforms and Difference Equations?
So this is when the Kronecker delta was added to Xcas as the inverse Z transform of 1. The function itself still isn't defined in the Prime's cas though.

Any chance it could be added in the next update?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)