Using \cdot in sprintf, with latex interpreter

set(0, 'defaultTextInterpreter', 'latex');
text(160, 1, (sprintf("$ i(t) = %g \cdot (1 - e^{-t/%g})$", iF, tau)),...
'Fontsize', 15)
This text is for a subtitle on a subplot. The "set interpreter latex" is at the beginning of my code because I need to use it multiple times. I need \cdot to display as a multiplication sign in the subtile. What its displaying right now is this, i(t) = 5 i(t) = 25 .

回答 (1 件)

Tibo Geenen
Tibo Geenen 2022 年 12 月 11 日
移動済み: Jan 2022 年 12 月 11 日

0 投票

text(0.5, 8, (sprintf("i(t) = %g \\cdot (1 - e^{-t/%g})", 1, 2)),'Fontsize', 15)
This should do it for you.

1 件のコメント

Jan
Jan 2022 年 12 月 11 日
Keep the $ characters.

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

製品

リリース

R2020b

タグ

質問済み:

2022 年 1 月 27 日

コメント済み:

Jan
2022 年 12 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by