# Mathcad to Mathematica: finding coil impedance I am new to Mathematica.

I am trying to figure out how to do the same thing in Mathematica as the image depicts done in Mathcad.

Declaring the variables with units I figured out.

U = Quantity[100, "Volts"];
f = Quantity[50, "Hz"];
R1 = Quantity[20, "Ohms"];
L1 = Quantity[0.005, "Henries"];
XL1 = UnitSimplify[2 π f L1]


I am stuck on how define Z1 with the angle.

• I don't speak MathCAD; can you translate the image into pseudocode, or explain how to interpret the angle stuff? Feb 6 '17 at 22:15

You can separate the impedance and phase shift:

Z1 = {Sqrt[R1^2 + XL1^2], Quantity[ArcTan[XL1/R1]*(180/Pi), "AngularDegrees"]}


{Quantity[20.0616, "Ohms"], Quantity[4.49078, "AngularDegrees"]}

Current calculation using the impedance part of the Z1 array using First

I1 = UnitSimplify[U/First@Z1]


Quantity[4.98465, "Amperes"]

For fun:

Clear[XL1, Z1, R1, L1]

R1 = 20;(*Ohms*)
L1 = 5/1000;(*Henries*)

XL1[freq_] := 2 Pi freq L1

Z1[freq_] := {Sqrt[R1^2 + XL1[freq]^2], ArcTan[XL1[freq]/R1]*(180/Pi)}

LogLogPlot[Z1[f], {f, 50, 1*^5}, AxesOrigin -> {10, 0}, Frame -> True]


For me, the most convenient way to handle phase angle is using complex numbers as phasors. Electrical engineers use J for the imaginary unit; Mathematicians use I. Here is an example:

In:= u = Quantity[100, "Volts"];

In:= f = Quantity[50., "Hz"];

In:= r1 = Quantity[20., "Ohms"];

In:= l1 = Quantity[0.005, "Henries"];

(* function to calculate reactance of inductor *)

zL[l_, f_] := 2 Pi f l I // UnitSimplify

In:= zL1 = zL[l1, f]

Out= Quantity[(0.  + 1.5708 I), "Ohms"]

In:= (* series circuit *)
z1 = zL1 + r1

Out= Quantity[(20.  + 1.5708 I), "Ohms"]

In:= i1 = u/z1 // UnitSimplify

Out= Quantity[(4.96935  - 0.390292 I), "Amperes"]

In:= (* magnitude of I *)
Abs[i1]

Out= Quantity[4.98465, "Amperes"]

In:= (* phase of I with respect to V in degrees *)
Arg[i1]/Degree

Out= -4.49078