USING MATLAB TO SOLVE THE NODE EQUATIONS
» R1=1000;R2=2000;R3=2000;
R4=4000; %resistances in Ohm
» iA=0.002;iB=0.004; %sources in Amps
» alpha=2; %gain of dependent source
DEFINE THE COMPONENTS OF THE CIRCUIT
DEFINE THE MATRIX G
» G=[(1/R1+1/R2),   -1/R1,   0; %first row of the matrix
-1/R1,    (1/R1+alpha+1/R2),   -(alpha+1/R2);  %second row
0,   -1/R2,    (1/R2+1/R4)], %third row. End in comma to have the echo
G =
    0.0015   -0.0010         0
   -0.0010    2.0015   -2.0005
         0   -0.0005    0.0008
Entries in a row are
separated by commas
(or plain spaces).
Rows are separated by
semi colon
DEFINE RIGHT HAND SIDE VECTOR
» I=[iA;-iA;iB]; %end in ";" to skip echo
SOLVE LINEAR EQUATION
» V=G\I  % end with carriage return and get the echo
V =
   11.9940
   15.9910
   15.9940