関数プロットのパラメ​ーターを変えてプロッ​トする方法

3 views (last 30 days)
kyosya
kyosya on 5 Dec 2020
Edited: Akiko on 6 Dec 2020
fplotで関数のグラフを作っています.その際,例えばax+bのような式をa, b変えながらをプロットするにはどうすればいいでしょうか.a, bは適宜手入力致します.

Accepted Answer

Akiko
Akiko on 6 Dec 2020
Edited: Akiko on 6 Dec 2020
分かりやすい方法としては、以下のドキュメンテーションの cubicpoly.m のように、一旦別の関数として記述する方法があります。
また、例に挙げていただいたような簡単な式であれば、無名関数を複数回使用して、以下のように手軽に記述することも可能です。
>> fun = @(x,a,b)a*x+b;
>> fplot(@(x)fun(x,2,1)) % a=2, b=1 を代入
この定義方法については、以下が参考になると思います。

More Answers (0)

Categories

Find more on 2 次元および 3 次元プロット in Help Center and File Exchange

Tags

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!