Text in plot with symbol and fractions

Hi
newbie here and first question
I need the place a text in a plot and i use
str1=cat(2,'x(\infty)=',num2str(y(1,end),'%1.4f'),', $1 -\frac{1}{\alpha(2)}$=',num2str(yt,'%9.4f'));
text(0.05,(1-0.05),str1,)
it doesnt use the simbol for alpha and dont use fractions
I also tried interpretar latex command, but maybe in the wrong position
how can i solve please?
is there a way to go head for the fractions, in other way to write 2 rows text in a single command?

 Respuesta aceptada

Star Strider
Star Strider el 19 de Mzo. de 2020
Editada: Star Strider el 19 de Mzo. de 2020
Try this:
str1={['$x(\infty)=',num2str(y(1,end),'%1.4f'),'$'], ['$1 -\frac{1}{\alpha(2)}=',num2str(yt,'%9.4f') '$']};
text(0.05,(1-0.05),str1, 'Interpreter','latex')
I am not certain what result you want. There may be easier and more efficient ways to create these strings, however this works.
EDIT —
Alternatively, if you want them on one line:
str1={['$x(\infty)=',num2str(y(1,end),'%1.4f'),'$, $1 -\frac{1}{\alpha(2)}=',num2str(yt,'%9.4f') '$']};
text(0.05,(1-0.05),str1, 'Interpreter','latex')

4 comentarios

Neil Henry
Neil Henry el 9 de Dic. de 2021
Thank you for the help :)
Star Strider
Star Strider el 9 de Dic. de 2021
My pleasure!
.
Eric Bernard Dilger
Eric Bernard Dilger el 13 de Jun. de 2022
It worked for me.
Thank you very much!!
Star Strider
Star Strider el 13 de Jun. de 2022
My pleasure!

Iniciar sesión para comentar.

Más respuestas (1)

Simo
Simo el 19 de Mzo. de 2020

0 votos

IT WORKS
THANK YOU VERY MATCH

Categorías

Preguntada:

el 18 de Mzo. de 2020

Comentada:

el 13 de Jun. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by