The interpreter attribute of the MATLAB text enables us to display a complex formula in the graph. For example, in the formula, there are not only Greek letters, but also mathematical symbols such as semicolons and roots.
When you type:> set (text, 'interpreter ')
MATLAB returns the property values contained in 'interpreter:
[Latex | {Tex} | none].
The default value is Tex.
The usage of Tex is detailed in the help document of MATLAB. Here we mainly introduce how to use latex to edit formulas.
In Matlab, latex edits the basic format of the formula:
\ (Mathematical formula \), $ mathematical formula $, or $ mathematical formula $.
Specific formula editing commands:
1. Use ^ as the upper mark and the following table to use _. The Greek letter is the same as Tex, that is, \ Alpha indicates α.
2. Sum
$ \ Sum _ {I = 1} ^ {n} X _ {I} $
3. Points
$ \ Int _ {0} ^ {1} $
4. Limit
$ \ Lim _ {n \ rightarrow \ infty} $ % N tends to be an infinite sign directly below Lim
$ \ Lim _ {n \ rightarrow \ infty} $ % the symbol tends to be infinite in the lower right corner of Lim
5. Fraction
$ \ Frac {1} x $ % 1/x
6. Root
$ \ SQRT {x} $
7. dashes
$ \ Overline {x} $
8. Underline
$ \ Underline {x} $ % underline at the bottom of X
9. Horizontal curly braces command
$ \ Overbrace {X + Y + Z + w} $
10. Raised curly braces command
$ A + \ underbrace {B + C + D} $
11. Cap command
$ \ Hat {o} \ check {o} \ breve {o} $
$ \ Widehat {A + B }\\\ widetilde {a + B} $
$ \ VEC {\ imath} + \ VEC {\ jmath} = \ VEC {k} $
12. Build commands
$ Y \ stackrel {\ RM def }{=} f (x) \ stackrel {x \ rightarrow 0 }{\ rightarrow} A $
13. ellipsis
$ \ Cdots \ ldots \ vdots \ ddots $
Example:
H = text;
Set (H, 'interpreter', 'latex ');
Set (H, 'string ', '$ \ sum _ {I = 1} ^ {n} X _ {I} = \ int _ {0} ^ {1} f (x) dx $ ', 'position', [0.1, 0.5], 'fontsize', 16 );