how do i plot til some x one function and then other

조회 수: 1 (최근 30일)
ABHISHEK N N
ABHISHEK N N 2020년 10월 22일
댓글: ABHISHEK N N 2020년 10월 22일
i want to plot plz help
y = { x x<=12
12 x>12 }

채택된 답변

Stephen23
Stephen23 2020년 10월 22일
편집: Stephen23 2020년 10월 22일
x = 0:0.1:20;
y = min(12,x);
plot(x,y,'-+')
In a more general case, use logical indexing, e.g.:
x = 0:0.1:20;
y = x;
y(y>12) = 12;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by