How to plot phasors of signals?

1.6k Views Asked by At

I have 3 singals and I'm trying to plot their phasors and their sum. I need to plot them end to end to demonstrate phasor addition. That is, the first phasor must start from the origin. The second phasor must start from the end of the first phasor. The third phasor must start from the end of the second one. In this way, the end point of the third phasor is the resulting phasor (considering that it starts at the origin). Horizontal and vertical axes are the real and imaginary axes, respectively in range of [-30, 30].

I just started using matlab today and this is due the night. I tried using plot, plot2, plot3, compass, and several ways but with all of them i failed. Compass was the closest to success.

I have amplitude and phase values of each phasor.

So how can I accomplish this task? Can you help me to draw two of phasors?

Any help is appreciated.

Thank you!

Related Example: from http://fourier.eng.hmc.edu/e84/lectures/ch3/node2.html

a

1

There are 1 best solutions below

0
On

I've done that some times, and i used the compass function as well. What you trying to do takes some hacking in the plot.

clc; close all
a=3*exp(j0); b=4*exp(j30); c=a+b; vet=[a b c];

figure(1)
Vet=compass(vet)

The data is plotted with the arrow starting at the origin, (0,0), now you must:

  • move the second arrow to the tip of the fist, or;
  • copy the first and move to the tip of the second and copy the second and move to the tip of the first.

This is done getting the xdata/ydata of the respective vectors on the plot.

set(Vet(2),{'xdata'},{get(Vet(2),'xdata')+real(vet(2))})
set(Vet(2),{'ydata'},{get(Vet(2),'ydata')+imag(vet(2))})

The second option i'll let you think a little bit on how to implement -- it's not that dificult -- but once you do you will have to get the xdata/ydata to move around the plotted data.

The xdata and ydata have the information of all the points that are used to plot the data. So, get the xdata of the second vector, say x2, and make it x2+x1, xdata of second vector + xdata of first vector; the same with the ydata.