Using \cdot in sprintf, with latex interpreter

14 vues (au cours des 30 derniers jours)
Jasilva
Jasilva le 27 Jan 2022
Commenté : Jan le 11 Déc 2022
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 .

Réponses (1)

Tibo Geenen
Tibo Geenen le 11 Déc 2022
Déplacé(e) : Jan le 11 Déc 2022
text(0.5, 8, (sprintf("i(t) = %g \\cdot (1 - e^{-t/%g})", 1, 2)),'Fontsize', 15)
This should do it for you.
  1 commentaire
Jan
Jan le 11 Déc 2022
Keep the $ characters.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Verification, Validation, and Test dans Help Center et File Exchange

Tags

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by