MATLAB: Raise power to power in title

power to power

Hi~
I wanna write a title to a graph this way >> y = x * e^(- x^2 / 2 )
title(' y = x*e^(- x^2 / 2) ') writes e as base and only ( as exponent
title(' y = x*e^-^x^2^/^2 ') shows e^(-x2/2) not as e^(-x^2/2)
any idea how to solve this? :\

Best Answer

  • Try this (using LaTeX):
    figure
    plot(rand(50,1), rand(50,1), 'p')
    axis([0 1 0 1])
    title('$y = x \times e^{- \frac{x^2}{2}}$', 'Interpreter','latex', 'FontSize',16)
    prodcing:
    .