How can I have 'angstrom square' as unit of y axis in a plot?

25 vues (au cours des 30 derniers jours)
Wei Liu
Wei Liu le 29 Sep 2017
Commenté : Eugenio le 20 Mar 2023
I need use 'angstrom square' as unit of y axis in a plot. I tried: >>ylabel('MSD (\AA^{2})','Interpreter','latex','Fontname','TimesNewRoman') but it did not work. The version of my Matlab is R2014a.
Thank you.

Réponses (1)

Star Strider
Star Strider le 29 Sep 2017
You forgot the dollar signs ($):
figure(1)
plot(rand(1,100), rand(1,100), 'pg')
ylabel('$MSD (\AA^{2})$','Interpreter','latex','Fontname','TimesNewRoman')
or:
ylabel('MSD ($\AA^{2}$)','Interpreter','latex','Fontname','TimesNewRoman')
Another option:
angsqr = [char(197) char(178)]
angsqr =
'Ų'
  3 commentaires
Star Strider
Star Strider le 30 Sep 2017
As always, my pleasure!
If my Answer solved your problem, please Accept it!
Eugenio
Eugenio le 20 Mar 2023
Another option would be
angs = [char(197)];
ylabel(strcat( angs ,'^{n}') )

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by