hp41programs

Z-Transform

Unilateral Z-Transform for the HP-41


Overview
 

-The unilateral  Z-transform of a sequence a0 a1 ............ an ........  is defined by  Z(x) = SUM k=0 to infinity  ak / xk
-"ZTF" calculates the sum from k=0 to k=n , n must be specified by the user.

-The sequence (an) only contains real number, whereas the variable may be real ( CF 02 ) or complex ( SF 02 )
 

Program Listing
 
 

Data Registers:                  ( Registers R00 thru Rnn are to be initialized before executing "ZTF" )

                    •  R00 = a0        •  R01 = a1        •  R02 = a2       ........................              •  Rnn = an

Flags:

  CF 02  for real variables
  SF 02 for complex variables

Subroutines: /
 
 

 01  LBL "ZTF"
 02  CLA
 03  STO M        
 04  RDN
 05  STO N
 06  RCL 00
 07  FS? 02
 08  GTO 00
 09  LBL 01
 10  RCL M
 11  RCL N        
 12  CHS
 13  Y^X
 14  RCL IND N
 15  *
 16  +
 17  DSE N
 18  GTO 01
 19  SIGN
 20  X<> M
 21  X<> L
 22  GTO 03
 23  LBL 00
 24  STO O        
 25  RDN
 26  LBL 02
 27  CLX
 28  RCL N
 29  RCL M
 30  R-P
 31  RCL Z        
 32  CHS
 33  ST* Z
 34  Y^X
 35  RCL IND Z
 36  *
 37  P-R
 38  ST+ O
 39  RDN
 40  ST+ P
 41  DSE Y
 42  GTO 02
 43  RCL P
 44  RCL O        
 45  LBL 03
 46  CLA
 47  END

 
    ( 79 bytes / SIZE nnn+1 )
 
 

      STACK   CF 02 INPUT  CF02-OUTPUT  SF 02 INPUT  SF02-OUTPUT
           Z             /             /            n             /
           Y             n             n            y            V
           X             x           Z(x)            x            U
           L             /             x            /            /

       Where  Z(x+i.y) = U + V.i

Example:   Assuming  { a0 a1 ............ an } = { 1 2 3 2 1 1/2 1/3 1/4 1/5 1/6 1/7 } , store these 11 numbers into R00 thru R10   ( n = 10 )

-To compute  Z(PI)

       CF 02

       10    ENTER^
       PI    XEQ "ZTF"  >>>>   Z(PI) = 2.017443943              ---Execution time = 9s---

-To compute  Z(2+3.i)

      SF 02

     10  ENTER^
      3   ENTER^
      2   XEQ "ZTF"    >>>>     1.173222278              ---Execution time = 22s---
                                 RDN    -0.677712005

 So,  Z(2+3.i) = 1.173222278 - 0.677712005 i
 

Reference:

[1]  http://mathworld.wolfram.com/Z-Transform.html