Post Reply 
Z Transform problem ?
03-15-2016, 06:59 PM
Post: #1
Z Transform problem ?
Hi !

Today in my school i made many exercice with the Z transform like the basic :1 -> z/z-1

So in the hp-prime i use this command : ztrans(1,n,z) and its show me a beautiful : z/z-1

Now i want to do the "inverse z transform"

So i use the command : invztrans(z/z-1,z,n) and its show me 1

every things is fine , but ...

when i used invztrans(2/z-3,z,n) , its show me (-2*Dirac(n)+2*3^n)/3 ... Wtf ?

its not the right answer , what is the problème ? :/

Thanks
Find all posts by this user
Quote this message in a reply
03-16-2016, 12:23 AM
Post: #2
RE: Z Transform problem ?
Actually, I believe the answer is correct solving invztrans(2/(z-3),z,n) though it might seam as an odd way of expressing the answer using the Dirac (or δ) function (δ(n)=1 for n=0 else δ=0).
The resulting expression of δ may seam odd because when you try to transform the result back to the z domain, i.e. ztrans(-2*Dirac(n)+2*3^n)/3,n,z), Prime delivers the result: sum(2*3^(n-1)*z^(-n)-(2/3)*z^(-n)*Dirac(n),n,0,∞) (after some warnings), so the ztrans and the invztrans function is not handling the Dirac function smoothly in this case. (You could argue that if the invztrans function introduces δ in a result the ztrans should also handle δ smoothly and restore the result back to the original state). (I used the HP Prime virtual calculator on a PC - version: 2015 6 17 Rev. 8151).
Find all posts by this user
Quote this message in a reply
03-16-2016, 07:16 AM
Post: #3
RE: Z Transform problem ?
The Dirac function is the δ function in the discrete context. I will add code to support it back inside ztrans.
Find all posts by this user
Quote this message in a reply
03-16-2016, 08:22 PM (This post was last modified: 03-17-2016 01:38 AM by Anders.)
Post: #4
RE: Z Transform problem ?
parisse, that would be great.

Here are some another thoughts:
The Student typically gets introduced to Z-transforms when taking a Discrete Control Theory or Digital Signal Processing course/topic. In these topics you would typically use the step function u[n] (u[n]=1 for n>=0 else =0) in time discrete domain and more seldom the δ[n] (except when doing invztrans(1) which is indeed = δ[n]). Hence, the student would be more familiar with what HP prime output if the answers were mostly formulated in terms of u[n] (where appropriate) rather than δ[n].

For the example above, the standard text book z-transform table entry the student would use in named courses would look something like this:

Time domain: b^(n-1)*u(n-1)
z-domain: 1/(z-b)

The reason why this is the preferable way to formulate it is because it fits with how the other transform entries looks like in the text books. It also illustrates the time delay (n-1) in the time series. Further, the other standard text book table entries would typically look like
Time domain: b^n
z-domain: z/(z-b)
and
Time domain: u[n]
z-domain: z/(z-1)
etc.

I attached a typical table I quickly found on internet to further illustrate my point. There are many more similar once that can be googled...
Hence, to not confuse the students it would be beneficial to use u[n] instead of δ[n] where possible.

So applying tables above to the example invztrans(2/(z-3),z,n) the HP prime should ideally output
2 * 3^(n-1)*u(n-1).

It would be great if all HP Prime z-transformation and inverse z-transformation output would follow the standard table text book look and notation. It would make it so much easier for the student.

Further, by convention we use the notation u[n] and δ[n] for the time discrete domain (δ[n] is the discrete Kronecker delta) rather than the Dirac delta term when calculating on paper. Dirac delta typically refers to δ(t) where t is in the continuous time domain (Real number domain) and the value of δ(t) when t=0 is actually infinity not 1. Note the use of [] for discrete domain and () for continuous (Real) domain when performing calculations on paper. On the Prime we could use δ(n) and u(n) for the discrete domain too as the notation is unambiguous in the z-transform context.
       
Find all posts by this user
Quote this message in a reply
03-17-2016, 07:06 AM
Post: #5
RE: Z Transform problem ?
I can obviously not adopt the notation of one domain if it is in conflict with other domains. For example, everybody is using i for sqrt(-1) on the calc despite the usual notation in physics is j. This means you will never have a u for the Heaviside function. I don't know if I'll modify the current code to replace discrete Dirac with Heaviside, because it's programming work in a field I do not use at all and it would certainly raise new bugs.
I really believe that the interest of having ztrans and invztrans in a CAS is not to have a table lookup replacement, it's to make the real computations, i.e. partial fraction decomposition for invztrans. This should be useful for students who really understand what's happening because they can make themselve the final adjustements to adapt to their field.
Find all posts by this user
Quote this message in a reply
03-17-2016, 10:20 AM (This post was last modified: 03-17-2016 10:22 AM by parisse.)
Post: #6
RE: Z Transform problem ?
After code review, I can replace Dirac by a new function named Kronecker to avoid confusion, and I can replace Kronecker by Heaviside but only for the simplest cases. The way I compute inverse z-transform is not adapted for a more general substitution.
You can check here
http://www-fourier.ujf-grenoble.fr/%7epa...ns(a,n,z)&
Make sure to clear your browser cache if you already visited this page.
Find all posts by this user
Quote this message in a reply
03-18-2016, 07:38 PM
Post: #7
RE: Z Transform problem ?
parisse, I think that would be great!
Find all posts by this user
Quote this message in a reply
Post Reply 




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