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

25 views (last 30 days)
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.

Answers (1)

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

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!