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

25 Ansichten (letzte 30 Tage)
Wei Liu
Wei Liu am 29 Sep. 2017
Kommentiert: Eugenio am 20 Mär. 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.

Antworten (1)

Star Strider
Star Strider am 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 Kommentare
Star Strider
Star Strider am 30 Sep. 2017
As always, my pleasure!
If my Answer solved your problem, please Accept it!
Eugenio
Eugenio am 20 Mär. 2023
Another option would be
angs = [char(197)];
ylabel(strcat( angs ,'^{n}') )

Melden Sie sich an, um zu kommentieren.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by