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

5 views (last 30 days)
遼 柄澤
遼 柄澤 on 7 Oct 2021
Commented: 遼 柄澤 on 11 Oct 2021
お世話になります。
y=x (0<=x<=2)
y=0.2x+1.6 (2<=x)
となる関数はどのようにプログラムすればいいのでしょうか?
よろしくお願いします。

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!