Display symbolic vector in LaTeX formulation

11 visualizaciones (últimos 30 días)
Francesco Porretta
Francesco Porretta el 14 de Mayo de 2021
Editada: Satyam el 6 de Feb. de 2025 a las 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?

Respuestas (1)

Satyam
Satyam el 6 de Feb. de 2025 a las 8:56
Editada: Satyam el 6 de Feb. de 2025 a las 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

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by