Message Boards Message Boards


Using Phasors in Mathematica (adding Cos[])

Posted 8 years ago
4 Replies
0 Total Likes

Hi, I am calculating both the amplitude and phase angle in electrical circuits that contain capacitors and inductors. Therefore I need to sum Cos[]'s in Mathematica in which I am having difficulty. Additionally I tried to use Phasor Notation to perform the summations without any success. The calculations are easily performed using my TI-89 calculator, but cannot duplicate the calculations using Mathematica: however I would much prefer to use Mathematica. Please review the attached Mathematica file for details and give me your thoughts. My version of Mathematica is


Mitch Sandlin

POSTED BY: Mitchell Sandlin
4 Replies
Posted 8 years ago

Now realized that Mitchell said he has MMA 9. To/FromPolarCoordinates are new in 10. So:

toPolarCoordinates[vect : {x_, y_}] := {Norm@vect, ArcTan[x, y]}

fromPolarCoordinates[{r_, ?_}] := r {Cos@?, Sin@?}
POSTED BY: Hans Milton
Posted 8 years ago

This is one way of many:

phasorAdd°[{rA_, ?A_}, {rB_, ?B_}] :=
      FromPolarCoordinates[{rA, ?A °}] + 
      FromPolarCoordinates[{rB, ?B °}]

phasorAdd°[{5, 36.87}, {10, -53.13}]
{11.1803, -26.5649}
POSTED BY: Hans Milton
Posted 8 years ago
In[1]:= eq1 = 
 a1 Exp[I ( \[Omega] t + \[Phi]1)] + a2 Exp[ I (\[Omega] t + \[Phi]2)] 

Out[1]= a1 E^(I (\[Phi]1 + t \[Omega])) + 
 a2 E^(I (\[Phi]2 + t \[Omega]))

In[2]:= eq2 = CoefficientList[eq1, Exp[I \[Omega] t]]

Out[2]= {0, a1 E^(I \[Phi]1) + a2 E^(I \[Phi]2)}

In[3]:= eq3 = 
 eq2[[2]] /. { a1 -> 5, 
   a2 -> 10, \[Phi]1 -> 36.87 Degree, \[Phi]2 -> - 53.13 Degree}

Out[3]= 10. - 4.99998 I

In[4]:= {1., 1./Degree} * 
 CoordinateTransform["Cartesian" -> "Polar", ReIm[eq3]]

Out[4]= {11.1803, -26.5649}
POSTED BY: Michael Helmle

You can replace the Cos[x] by a complex exponential E^(I x). All operations are easier with the exponentials. At the end, take the real part of the result.

POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract