필터 지우기
필터 지우기

Text in plot with symbol and fractions

조회 수: 32 (최근 30일)
Simo
Simo 2020년 3월 18일
댓글: Star Strider 2022년 6월 13일
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?

채택된 답변

Star Strider
Star Strider 2020년 3월 19일
편집: Star Strider 2020년 3월 19일
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
Eric Bernard Dilger
Eric Bernard Dilger 2022년 6월 13일
It worked for me.
Thank you very much!!
Star Strider
Star Strider 2022년 6월 13일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Simo
Simo 2020년 3월 19일
IT WORKS
THANK YOU VERY MATCH

카테고리

Help CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by