Display symbolic vector in LaTeX formulation

11 ビュー (過去 30 日間)
Francesco Porretta
Francesco Porretta 2021 年 5 月 14 日
編集済み: Satyam 2025 年 2 月 6 日 8:57
I have a vector of symbolic elements (like angle "phi').
What I want to do is to see in the command window (or somewhere else) my vector with the LaTeX notation instead of the matlab one. In other words, I want to see in the command window something like the following form:
instead of " cos(psi_R(t)) "
Does someone know how to do?

回答 (1 件)

Satyam
Satyam 2025 年 2 月 6 日 8:56
編集済み: Satyam 2025 年 2 月 6 日 8:57
Hi,
You can’t display LaTeX notation on console since it only supports Unicode characters. For more details, you can refer to a related discussion: https://www.mathworks.com/matlabcentral/answers/1904575-is-it-possible-to-display-text-in-the-console-using-latex-expressions
However, you can use LaTeX to format text in ‘plot’, such as axis labels, titles, and annotations. To include LaTeX symbols, set the ‘Interpreter’ property to 'latex'. Here's an example demonstrating how to use LaTeX in an ‘annotation’:
figure;
annotation('textbox', [0.4, 0.5, 0.2, 0.2], 'String', '$\cos(\psi_R(t))$', 'Interpreter', 'latex','EdgeColor', 'none');
In this example, a ‘textbox’ annotation is added to the figure with the LaTeX formatted string ‘$\cos(\psi_R(t))$’. The ‘Interpreter’ property is set to 'latex’ to ensure the text is rendered correctly.
For more information on ‘textbox’ properties, you can refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/matlab.graphics.shape.textbox-properties.html

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by