Hi, I am facing difficulty in plotting these functions.
조회 수: 1 (최근 30일)
이전 댓글 표시
How can i compare a string a =[0: 0.05: 10] with a constant value, say 5. I want the string to be compared with that constant, and for values of a greater than 5, i want to plot another function.
a =[0: 0.05: 10];
if a > 5
y = sin(2*pi*a);
else
y=0;
but this is not working.
댓글 수: 0
채택된 답변
Star Strider
2019년 7월 20일
Try this:
a = 0 : 0.05 : 10;
y = sin(2*pi*a.*(a>5));
figure
plot(a, y)
grid
Experiment to get the result you want.
댓글 수: 2
Star Strider
2019년 7월 20일
My pleasure.
If my Answer helped you solve your problem, please Accept it!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!