making a up down ramp
조회 수: 5 (최근 30일)
이전 댓글 표시
For a assignment I am supposed to make a ramp function that goes up plaeteous and then goes back down. My proffesor said use a time array but I do not know what that means. I tried using a peicewise command but that did not work.
댓글 수: 6
Stephan
2020년 10월 30일
Show us what you have done so far and where your specific problem is. Also is there more information about the assignment? Maybe piecewise is not that what your professor wants you to use.
채택된 답변
Stephan
2020년 10월 30일
편집: Stephan
2020년 10월 30일
I think you can do the rest by yourself:
t = [0:0.001:5];%
y = zeros(1, length(t));%
index_1 = find(t>0.5 & t<1);%
index_2 = find(t>1 & t<2);
index_3 = find(t>2 & t<2.5);
y(index_1) = 100*t(index_1);%
y(index_2) =0.5;
y(index_3)= -100*t(index_3);
plot(t,y)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!