How to perform mathematical conditions
조회 수: 6 (최근 30일)
이전 댓글 표시
I have to reproduce this plot:

The function is :
As you see in the plot, on the Y-axis we have this condition : [0,-pi]
So my attempt:
function alfa= fas(O,Q)
a=O/Q; b=1-O.^2;
alfa = atan(-(a)./(b));
end
clc
clear all
O=0:0.01:3.1;
for Q = [2 5 10]
y=fas(O,Q);
plot(O,y)
hold on
grid on
xlabel('/Omega')
ylabel('phase')
end

How can I get a plot just like the first one ?
I dont know how to perform the condition on Y-axis which is [0,-pi]
댓글 수: 0
답변 (1개)
KSSV
2021년 3월 18일
Use atan2 instead of atan.
function alfa= fas(O,Q)
a=O/Q; b=1-O.^2;
alfa = atan2(-a, b);
end
댓글 수: 6
참고 항목
카테고리
Help Center 및 File Exchange에서 Statics and Dynamics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
