# Ladder Node Analysis Demo
# Enter component values for your network as shown below:
# You an enter mutiple components on one line as follows:
#    R1=5e3;R2=10e3
# You can define one component in term of another as follows:
#   R1=5e3;R2=2*R1
# Suppose we want to analyze an R1/R2 ladder network composed of
# 10K and 5K resistors.

# Comment lines such as this have an "#" as the first character of the line.
# In this Demo the ladder series resistors R1=10k and the shunt resistors
# R2=5k. The network has 10 nodes. The input voltage is 10 volts with a source
# resistance of 50 ohms.
# When using NODE analysys the voltage sources should be converted to
# current sources in order to simpify the network equations.

NODES=10          # Number of Nodes
VG= 8.0              # 8.0 volt source generator
RG= 10.0            # 10 ohm source resistance
IG =VG/RG          # Current generator defination

R1 = 5e3             # Series resistor value
R2 = 10e3           # Shunt resistor value
RL = R1               # Last shunt resistor

# Now since we are going to use "Node Analysis" in this demo the following lines
# define the admittance terms. Your network equations will use the following
# three terms.

YG = 1/RG    # This is the addmittance of the 50 ohm source. 
Y1 = 1/R1
Y2 = 1/R2
YL=Y1

# Show current in last shunt resistor in milliamps.
Goals=1
Goal1=('e10/RL*1000','ma.')