Inverse z-transform and ploting



On 02/02/2012 04:33 AM, subiono2008 at matematika.its.ac.id wrote:
>      Let be X(z) a z-transform of a sequence x[n]
>      How do we calculate invers z-transform of X(z) and
>      plot x[n].
>

Here is an example:

(%i2) X: z/(z-2)$

(%i3) f[0]:  ratsimp (ev(X, z=1/y))$

(%i4) f[n] := ratsimp (diff (f[n-1], y)/n)$

(%i5) f[5];

(%o5) 32/(64*y^6-192*y^5+240*y^4-160*y^3+60*y^2-12*y+1)
(%i6) x[5]: ev (f[5], y=0);

(%o6) 32
(%i7) plot2d ( [discrete, makelist(i,i,0,5), makelist(ev(f[i],y=0), i, 
0, 5)], [style, points]);

In this example you can easily see that x[n] can be written as 2^n, but 
in a general case it
might not be possible to write x[n] as a function of n. Also, notice 
that (%i5) was necessary
in order to calculte al functions f[1]...f[5], before ev(f[i], y=0) can 
be used. Otherwise, if
you attempt to use ev on a function f[n] which has not been computed 
yet, you will get
an error because the substitution y=0 will be done before the derivative.

The use of ratsimp is also necessary to avoid terms with 1/y which would 
lead to a division
by zero error. I hope this helps you.

Regards,
Jaime