Display symbolic vector in LaTeX formulation

11 vues (au cours des 30 derniers jours)
Francesco Porretta
Francesco Porretta le 14 Mai 2021
Modifié(e) : Satyam le 6 Fév 2025 à 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?

Réponses (1)

Satyam
Satyam le 6 Fév 2025 à 8:56
Modifié(e) : Satyam le 6 Fév 2025 à 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

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by