MATLAB Answers

End to end plots

18 views (last 30 days)
Muhammad Ali Khan
Muhammad Ali Khan on 3 Mar 2021
Answered: Star Strider on 3 Mar 2021
Hi, I am a student and I am working with phasors. I have three phasors and I have plotted them all individually but now I need to plot all three of them end to end and I can't understand how to. By end to end I mean, the first phasor starts at zero and when it ends, the second phasor should start from phasor 1's end and then the thrid should start from the second 's end. I am trying to achive phasor addition geometrically.
I plotted them all individually with the following code where F, S and T represent First, Second and Third phasors respectively:
plot([0, real(F)], [0, imag(F)])
hold on
plot([0, real(S)], [0, imag(S)])
hold on
plot([0, real(T)], [0, imag(T)])
hold on

Answers (1)

Star Strider
Star Strider on 3 Mar 2021
Try this:
F = complex(rand,rand); % Use Actual Complex Value
S = complex(rand,rand); % Use Actual Complex Value
T = complex(rand,rand); % Use Actual Complex Value
FST = [0+0j; F; S; T]; % Vertically Concatenate Them
figure
plot(cumsum(real(FST)), cumsum(imag(FST)), '.-')
grid
.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!