PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Alternating Current Analysis 295


% Solution for nodal voltages V1 and V2
V = inv(Y)*I;
% Solution for the magnitude and phase angle
V1mag = abs(V(1));
V2mag = abs(V(2));
V1ang = angle(V(1))*180/pi;
V2ang = angle(V(2))*180/pi;
% Print voltages
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
disp(‘ phasor domain ’)
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
fprintf(‘The magnitude of the voltage V1 (in volts) is :%f\n and its
phase angle in degrees is :%f\n’,V1mag,V1ang)
fprintf(‘The magnitude of the voltage V2 (in voltss) is :%f\n and its
phase angle in degrees is:%f\n’,V2mag,V2ang)
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
disp(‘ time domain ’)
disp(‘^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^’)
fprintf(‘The voltage v1(t)=%fcos(10t+%f)voltss\n’,V1mag,V1ang)
fprintf(‘The voltage v2(t)=%fcos(10t+%f)voltss\n’,V2mag,V2ang)
disp(‘****************************************************’)

The script fi le nodes is executed and the results are indicated as follows:

>> nodes
*********************************************
System Matrices
*********************************************
The admittance matrix Y is given by:
Y =
2.0000 - 1.0000i 0 + 1.0000i
0 + 1.0000i 4.0000 - 4.0000i
The current matrix I is given by:
I =
5.0000
0 + 6.0000i
************************************************
Node voltages
************************************************
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
phasor domain
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The magnitude of the voltage V1 (in volts) is: 2.523265
and its phase angle in degrees is : 29.811543
The magnitude of the voltage V2 (in volts) is: 0.709196
and its phase angle in degrees is:116.778840
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
time domain
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The voltage v1(t) = 2.523265 cos(10t+29.811543) volts
The voltage v2(t) = 0.709196 cos(10t+116.778840) volts
******************************************************
Free download pdf