Mathcad example of solving 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.

  • $\begingroup$ I don't speak MathCAD; can you translate the image into pseudocode, or explain how to interpret the angle stuff? $\endgroup$
    – MarcoB
    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[1]:= u = Quantity[100, "Volts"];

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

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

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

(* function to calculate reactance of inductor *)

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

In[6]:= zL1 = zL[l1, f]

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

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

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

In[8]:= i1 = u/z1 // UnitSimplify

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

In[9]:= (* magnitude of I *)

Out[9]= Quantity[4.98465, "Amperes"]

In[10]:= (* phase of I with respect to V in degrees *)

Out[10]= -4.49078

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.