How to build signal diagrams?

I have 3 singals, and I'm trying to build their phasors and their sum. I need to build them to the end to demonstrate the addition of phasor. That is, the first phasor should start at the origin. The second phasor should begin at the end of the first phasor. The third phasor should begin at the end of the second. Thus, the end point of the third phasor is the resulting phasor (given that it begins at the origin). The horizontal and vertical axes represent the real and imaginary axes, respectively, in the range [-30, 30].

I just started using Matlab today, and it happens at night. I tried using plot, plot2, plot3, compass and several ways, but with all of them I failed. The compass was the closest to success.

I have the amplitude and phase values โ€‹โ€‹of each phaser.

So how can I complete this task? Can you help me draw two phasors?

Any help is appreciated.

Thanks!

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

a

[spectrum example]

  • phasors image example
+5
source share
2 answers

In the following example, you should start:

First, three phasors are determined.

% Define three complex numbers by magnitude and phase ph1 = 20*exp(1i*0.25*pi); ph2 = 10*exp(1i*0.7*pi); ph3 = 5*exp(1i*1.2*pi); 

Then, using cumsum , a vector is computed containing ph1, ph1+ph2, ph1+ph2+ph3 .

 % Step-wise vector sum vecs = cumsum([ph1; ph2; ph3]); vecs = [0; vecs]; % add origin as starting point 

Complex numbers are built on the real and imaginary parts.

 % Plot figure; plot(real(vecs), imag(vecs), '-+'); xlim([-30 30]); ylim([-30 30]); xlabel('real part'); ylabel('imaginary part'); grid on; 

This leads to the following figure: plot produced by the above code

+3
source
 figure(1); hold on; ang = [0.1 0.2 0.7] ; % Angles in rad r = [1 2 4] ; % Vector of radius start = [0 0] for i=1:numel(r) plot([start(1) start(1)+r(i)*cos(ang(i))],[start(2) start(2)+r(i)*sin(ang(i))],'b-+') start=start+[r(i)*cos(ang(i)) r(i)*sin(ang(i))] end plot([0 start(1)],[0 start(2)],'r-') 
+2
source

Source: https://habr.com/ru/post/1213903/


All Articles