Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Kutlu Yigitturk
Kutlu Yigitturk el 1 de Mzo. de 2021
Comentada: Kutlu Yigitturk el 1 de Mzo. de 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 comentario
Kutlu Yigitturk
Kutlu Yigitturk el 1 de Mzo. de 2021
Solution Found
We need to swap x and y in "compass (x, y);% plot vector" line.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by