blob: b9e2ea414617c6457407eeedbf27017597b8561f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
clc
clear
//input
i=8-(%i*6);//current flowing in amperes
z=10+(%i*10);//impedance in ohms
//calculations
I=(((real(i))^2)+((imag(i))^2))^0.5;//current magnitude in amperes
Z=(((real(z))^2)+((imag(z))^2))^0.5;//magnitude of impedance in ohms
phi1=(180/%pi)*atan(-(imag(i))/(real(i)));//phase angle of current in degrees
phi2=(180/%pi)*atan(-(imag(z))/(real(z)));//phase angle of impedance in degrees
phi=-(phi2+phi1);
v=I*Z;//voltage across coil in volts
//output
mprintf('the voltage across the coil is %3.0f V leading by %3.0f degrees',v,phi)
|