フィルターのクリア

Upper script Variable in the text

1 回表示 (過去 30 日間)
Orkun OZENER
Orkun OZENER 2018 年 8 月 6 日
コメント済み: Orkun OZENER 2018 年 8 月 7 日
Hi,
I have a fit equation like
a*x^b
I am obtaining the coefficients like this
COEFF = coeffvalues(fittedmodel) a=COEFF(1) b=COEFF(2)
And try to write the equation on plot window.But the upper script (^b section) is always failing. Only the minus sign goes to uppersciprt always
Here is the code
txt = ['y=', num2str(a) ,'*x','^', num2str(b)]
text(50,999,txt);
Any Help???

採用された回答

Stephen23
Stephen23 2018 年 8 月 6 日
編集済み: Stephen23 2018 年 8 月 6 日
Put curly braces around the part you want to be superscript:
^{...}
The TeX/LaTeX languages use curly braces to group things together. You can learn more here:
Note that sprintf would be neater and more efficient than using concatenation, e.g.:
txt = sprintf('y=%g*x^{%g}',a,b)
  1 件のコメント
Orkun OZENER
Orkun OZENER 2018 年 8 月 7 日
Thank you indeed. BR Orkun

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by