How do I put a hat on a character displayed in a text object within a figure in MATLAB?
855 views (last 30 days)
Show older comments
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.
Accepted Answer
MathWorks Support Team
on 27 Jun 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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!