2つの一次関数を組み合わせたい

10 次查看(过去 30 天)
遼 柄澤
遼 柄澤 2021-10-7
评论: 遼 柄澤 2021-10-11
お世話になります。
y=x (0<=x<=2)
y=0.2x+1.6 (2<=x)
となる関数はどのようにプログラムすればいいのでしょうか?
よろしくお願いします。

采纳的回答

Hernia Baby
Hernia Baby 2021-10-7
piecewise を使うとシンプルにできます
syms x
y = piecewise(0<=x<=2,x,2<=x,0.2*x+1.6)
y = 
fplot(y)
  1 个评论
遼 柄澤
遼 柄澤 2021-10-11
ありがとうございます。

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!