필터 지우기
필터 지우기

creating plane piecewise in one plot

조회 수: 1 (최근 30일)
Ugur Sahin
Ugur Sahin 2020년 3월 30일
답변: Star Strider 2020년 3월 30일
I am trying to plane something a piecewise function;
0<x<1 y=3x
1<x<2 y=2x+1
2<x<3 y=6x+1
ı have to plot that one graph, one function.

답변 (1개)

Star Strider
Star Strider 2020년 3월 30일
Try this:
f = @(x) (3*x).*((0<x) & (x<=1)) + (2*x+1).*((1<x) & (x<=2)) + (6*x+1).*((2<x) & (x<=3));
x = linspace(0, 3);
plot(x, f(x))
grid

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by