matlab is a mathematical language (software) for data calculation and processing, and latex is particularly useful for typesetting of the publishing language (software), especially for mathematical formulas. In MATLAB, there are two ways to use latex:1) in MATLAB to generate a graphical callout, 2) MATLAB calculation results converted to latex format. 1) graphical annotations generated by MATLABThe interpreter attributes of title, Xlabel, Ylabel, Zlabel, TextBox, and legend in MATLAB graphics have three properties: Latex, Tex, none. The default is Tex. (Note: Latex is a set of macro software described in Tex.) Latex has many pre-defined templates and styles. It is more structured than Tex, including macros and common software for indexing, tables, lists, and so on. With this format, even if the user does not have the knowledge of typesetting and program design, it can give full play to the powerful functions provided by Tex, which is particularly important for generating complex tables and mathematical formulas. To facilitate the use of LATEX commands, you need to set the interpreter properties of the title, Xlabel, Ylabel, Zlabel, TextBox, and legend in MATLAB graphics to latex. First of all, there are three types of latex language formats used in MATLAB:1, \ (Latex command \)2, $ latex command $3, $$ latex command $$as an example of a TextBox attribute in a MATLAB graphic, first enter a double integral in the graph and then enter a Schrodinger equation. The command is:text (' Interpreter ', ' latex ',...' String ', '∫x0∫ydF(u,v) ∫0x∫ydf (u,v)',...' Position ', [. 2.8],...' FontSize ', (+)text (' Interpreter ', ' latex ',...' String ', '−?22M∂2ψ (x∂ x2=eΨ< Span id= "mathjax-span-51" class= "Mo" > (x ) /span> −?22m∂2ψ (x) ∂x2=eψ (x) ',...' Position ', [. 2.4],...' FontSize ', (+)The output result isof course, you can also use the \ (\) command. You can also use Latex commands for title, Xlabel, Ylabel, Zlabel, and legend, for example:Xlabel ({'∫x0∫ydF(u,v) ∫0x∫ydf (u,v) '}, ' interpreter ', ' latex ')The latex command can be used as a reference for latex tutorials. 2) Convert MATLAB calculation results into latex formatFor the results of the symbolic operation calculated by Matlab, the latex () function can be converted into the Letex command format. Since the Latex () function converts only symbolic expressions, it must be converted to symbolic results by the sym () function for numerical results. Therefore, to prevent errors in the conversion of numerical results, the latex () and sym () functions can be used simultaneously: Latex (sym (s)); where s represents the symbol expression. For example: Syms a b cs=a/b+c uses Latex (s) to convert to the Letex command: {\frac {a}{b}}+cattached: commands and symbols for mathematical symbols and Greek letters
From:http://blog.sciencenet.cn/blog-287752-309833.html
Using latex in MATLAB