MATLAB Answers

How to use the power operator in xlabel?

1.053 views (last 30 days)
Marijn
Marijn on 7 Dec 2013
Commented: Mohamed Alhamri on 30 Oct 2019
Hi,
I want to add this xlabel to my figure: xlabel = ('A*R^(2/3) (m^(8/3))'). What my matlab does is instead of displaying the '^-sign' it places the first symbol after the operator in superscript, see figure attached. How can I overcome this problem (by either displaying the '^-sign' or by placing the entire term in superscript)?
Thanks, Marijn

  0 Comments

Sign in to comment.

Accepted Answer

sixwwwwww
sixwwwwww on 7 Dec 2013
use xlabel as below:
xlabel('A*R^(2/3) (m^(8/3))', 'Interpreter', 'none')

  6 Comments

Show 3 older comments
sixwwwwww
sixwwwwww on 8 Dec 2013
Yes it is working because user want to show exactly A*R^(2/3) (m^(8/3)) in the label instead of showing powers in super scripts. So that's why I used property 'Interpreter', 'none' so that MATLAB can't use its default property 'Interpreter', 'tex' to change the output display
Azzi Abdelmalek
Azzi Abdelmalek on 8 Dec 2013
Ok, it's also possible to do it:
xlabel('A*R\^(2/3) (m\^(8/3))')
Hamdullah Livaoglu
Hamdullah Livaoglu on 8 Feb 2017
it doesnt' work in num2str?! like; text(double(tx),double(ty),['Q=',cfe1,'*x^',{cfe2}],'FontSize',12)

Sign in to comment.

More Answers (3)

G A
G A on 7 Dec 2013
xlabel('A*R^{2/3}m^{8/3}')

  4 Comments

Show 1 older comment
G A
G A on 8 Dec 2013
In my system (R2013b win64) this is working - I checked before answering. This is for: "...or by placing the entire term in superscript"

Sign in to comment.



IEESHAN SHARMA
IEESHAN SHARMA on 19 Nov 2017
Use title('Mean squared error xrec(t)-x(t)^{2}'). Make sure you use curly braces.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by