How do I put a hat on a character displayed in a text object within a figure in MATLAB?

139 vues (au cours des 30 derniers jours)
I would like to put a hat (^) on a character that is displayed in an X-Label, Y-Label, Z-Label, Title or other text object within a figure in MATLAB.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 27 Juin 2009
As of MATLAB 7.0 (R14), "LaTeX" has been added as an optional interpreter for text objects in a figure.
In order to put a hat on a character that is to be displayed within a figure, the "Interpreter" property of the text should to be set to "LaTeX" and the equivalent LaTeX command "\hat{x}" should be typed as "$$\hat{x}$$".
For example, to have "x-hat" displayed in the X-Label, do the following:
xlabel('$$\hat{x}$$','Interpreter','Latex')
Another example to have "x-hat" displayed as text is:
text(xp,yp,'$$\hat{x}$$','Interpreter','Latex')
where "xp" and "yp" determine the position of the displayed text.
There are no known workarounds for MATLAB 6.5.1 (R13SP1) or earlier versions.

Plus de réponses (0)

Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by