Filter löschen
Filter löschen

How do I get the phasor to rotate clock-wise direction?

2 Ansichten (letzte 30 Tage)
Kutlu Yigitturk
Kutlu Yigitturk am 1 Mär. 2021
Kommentiert: Kutlu Yigitturk am 1 Mär. 2021
f = input(' frequency in Hz >> ')
A = input(' amplitude (>0) >> ')
theta = input(' phase in degrees >> ')
omega = 2*pi*f; % frequency rad/s
tmax = 1/f; % one period of sinusoid
time = [ ]; n=0; % initialization
figure(1)
for t=0:tmax/36:tmax % loop
z=A*exp(j*(omega*t+theta*pi/180));
x=real(z); y = imag(z); % projection
time = [time t]; % sequence
subplot(121) % subplot 1 of 2
compass(x,y); % plot vector
axis('square') % square axis
subplot(122)
plot(n*tmax/36,x,'*r') % plot x point in red ’*’
axis('square');
axis([0 tmax -1.1*A 1.1*A]); grid % bounds; grid
hold on % hold current plot
if n == 0 % execute next statement when n=0
pause(1) % pause
else % if n=0 not satisfied go next statement
pause(0.1)
end % end of conditional
n = n+1; % increment
end % end loop
hold on % dismiss hold on
The user enters the frequency, amplitude and phase in degrees values and obtains a phasor graph. I am just getting the phasor graph rotating anti-clock-wise whit this code. What should I do to get a clock-wise rotating phasor graph?
Thank you for your help.
  1 Kommentar
Kutlu Yigitturk
Kutlu Yigitturk am 1 Mär. 2021
Solution Found
We need to swap x and y in "compass (x, y);% plot vector" line.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by