Nodal analysis 3

.PS
include(pstricks.m4)

scale=25.4  # Scale in mm per inch

cct_init

vsp=25  # Vertical spacing
hsp=25  # Horizontal spacing

O: (0,0)  # Define the origin point for the circuit

move to O

I2: source(up_ vsp,I); llabel(,i_2,); rlabel(,2\;\text{mA},)
line right hsp
{ # Push current location to the "stack"
  Va: dot(at Here)
  R1: resistor(down_ to (Here.x,O.y)); rlabel(,R_1,); llabel(,1\;\text{k}\Omega,)
  dot(at Here)
} # Return to the previous location on the "stack"
V1: source(right_ 0.75*hsp,V,,R); llabel(,v_1,); rlabel(,10\;\text{V},)
R3: resistor(right_ 0.75*hsp); llabel(,R_3,); rlabel(,2\;\text{k}\Omega,)
{ # Push current location to the "stack"
  Vb: dot(at Here)
  R2: resistor(down_ to (Here.x,O.y)); rlabel(,R_2,); llabel(,4\;\text{k}\Omega,)
  dot(at Here)
} # Return to the previous location on the "stack"
line right hsp
I1: source(down_ to (Here.x,O.y),I); rlabel(,i_1,); llabel(,2\;\text{mA},)
line left to R1.end
ground(at Here)
line to O

# Label the nodes with their voltages
"$v_a$" at Va.n above
"$v_b$" at Vb.n above

.PE