How to plot symbolic function with string specification?

1 回表示 (過去 30 日間)
Niklas Kurz
Niklas Kurz 2022 年 2 月 3 日
回答済み: Steven Lord 2022 年 2 月 3 日
Briefly I want to execute
syms x
f = x
fplot(f,'b','LineWidth',2)
but a little fancier. I want the specification to be a string that I just can add. For instance:
syms x
f = x
str = ['b','LineWidth',2];
fplot(f,str)
Unfortunately this outputs an error

採用された回答

Steven Lord
Steven Lord 2022 年 2 月 3 日
Store your options as a cell array and turn it into a comma-separated list when you call fplot.
syms x
f = x;
options = {'b','LineWidth',2};
fplot(f, options{:})

その他の回答 (1 件)

KSSV
KSSV 2022 年 2 月 3 日
May be you can consider using like below.
syms x ;
f = x ;
h = fplot(f) ;
h.LineWidth = 2 ;

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by