S-PAR

                 Function for S Parameters design
                         Version 2.1

       These are some function that I use in my calcolus in RF design with
the HP48SX and since I think that even more ham are interested in microwave
band I've posted it.

       Follow the description of the function present in the S directory,
some routine that can help you in S parameter design at high frequencies.


{MAG}- Maximum Available Gain:
    IN: (1:)S11 (2:)S12 (3:)S21 (4:)S22
    OUT: (1:)MAG
    S parameters must be inserted in polar form referred to 50 ohm
    Gain is given in dB.

{MSG}- Maximum Stable Gain:
    IN: (1:)S12 (2:)S21   <<<<<< ATTENTION: this is the only function
                           that use only  S12 and S21 ! >>>>>>>>
    OUT: (1:)MAG
    S parameters must be inserted in polar form referred to 50 ohm
    Gain is given in dB.

{K}- Stability factor:
    IN: (1:)S11 (2:)S12 (3:)S21 (4:)S22
    OUT: (1:)K
    K value is in the range from 0 to 1

{RHOIN}-Reflection coefficient at the input port when the output is matched:
    IN: (1:)S11 (2:)S12 (3:)S21 (4:)S22
    OUT: (1:)RHOIN
    It gives the reflection coefficient that you see at input port when the
    output port is matched, by the use of {->Z} function you can obtain the
    input impedance to match whit the source.

{RHOUT}-Reflection coefficient at the output port when the input is matched:
    IN: (1:)S11 (2:)S12 (3:)S21 (4:)S22
    OUT: (1:)RHOUT
    It gives the reflection coefficient that you see at output port when
    the input port is matched, by the use of {->Z} function you can obtain
    the output impedance to match whit the load.

{->Z}-From reflection coefficient to impedance (Z) (referred to {Z0})
    IN: (1:)S11 or (1:)S22 or (1:)RHOIN or (1:)RHOUT
    OUT: (1:)Z11 or (1:)Z22
    It transform the polar value of S11 or S22 in the correspondent value
    of impedance referred to Z0.

{Z->}-From impedance (Z) to reflection coefficient (referred to {Z0})
    IN: (1:)Z11 or (1:)Z22
    OUT: (1:)S11 or (1:)S22 or (1:)RHOIN or (1:)RHOUT

{Z0}-Reference impedance
    Value used by {SZ} but useful to know during calculation; usually 50
    ohm; can be used every value

Place the following dir under path HOME/......./RF/S  in provision of new
program for Radio Frequencies design.


--------cut here------------------------------------------------
%%HP: T(3)A(D)F(.);
DIR
 MSG
   \<< SWAP / ABS
LOG 10 *
   \>>
 MAG
   \<< 4 DUPN K EVAL
5 ROLLD \-> I R D O
     \<< 1 I ABS SQ
+ O ABS SQ - O I *
D R * - ABS -
       IF 0 >
       THEN DUP SQ
1 - \v/ NEG +
       ELSE DUP SQ
1 - \v/ +
       END LOG 10
* R D MSG EVAL +
     \>>
   \>>
 K
   \<< 4 DUPN 4 ROLL
* 3 ROLLD * - ABS
SQ 1 + 5 ROLLD ABS
SQ NEG 4 ROLLD ABS
SWAP ABS * 2 * SWAP
ABS SQ NEG SWAP 4
ROLLD + + SWAP /
   \>>
 \GrIN
   \<< \-> S11 S12 S21
S22
     \<< 1 S11 ABS
SQ + S22 ABS SQ -
S11 S22 * S12 S21 *
- ABS SQ - S11 S22
CONJ S11 S22 * S12
S21 * - * - DUP ARG
3 ROLLD ABS DUP2 SQ
4 * NEG SWAP SQ + \v/
3 PICK
       IF 0 >
       THEN NEG
       END 3 ROLL
+ SWAP 2 * / SWAP
DUP SIN i * SWAP
COS + *
     \>>
   \>>
 \GrOUT
   \<< \-> S11 S12 S21
S22
     \<< 1 S22 ABS
SQ + S11 ABS SQ -
S11 S22 * S12 S21 *
- ABS SQ - S22 S11
CONJ S11 S22 * S12
S21 * - * - DUP ARG
3 ROLLD ABS DUP2 SQ
4 * NEG SWAP SQ + \v/
3 PICK
       IF 0 >
       THEN NEG
       END 3 ROLL
+ SWAP 2 * / SWAP
DUP SIN i * SWAP
COS + *
     \>>
   \>>
 \->Z
   \<< DUP 1 + SWAP
1 - NEG / Z0 *
   \>>
 Z\->
   \<< DUP Z0 - SWAP
Z0 + /
   \>>
 Z0 50
END
----------------------------------------------------------------
Send suggestions, comments, complaints to:


------------------------------------------------------------------------------
Lapo Pieri               |       INTERNET:  [email protected]
                        |       Phone   +39 55 4378512  (PABX-> 276)
Istituto per la          |
Ricerca sulle Onde       |       Home address: via A. dei Corbizi 9
Elettromagnetiche (IROE) |                     50127  FIRENZE
    (Firenze)           |                            ITALY
                        |
of the National          |       On air  IK5NAX
Council of Research (CNR)|
------------------------------------------------------------------------------