필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Kutlu Yigitturk
Kutlu Yigitturk 2021년 3월 1일
댓글: Kutlu Yigitturk 2021년 3월 1일
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
Kutlu Yigitturk
Kutlu Yigitturk 2021년 3월 1일
Solution Found
We need to swap x and y in "compass (x, y);% plot vector" line.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by