필터 지우기
필터 지우기

Add Bar over Letter x for mean value symbol

조회 수: 138 (최근 30일)
Dennis
Dennis 2022년 10월 25일
댓글: Star Strider 2022년 10월 25일
Hey guys I got the folloving code and would love to set a bar above the letter x to get the mean-symbol. But it's not functioning.
strVDrift = {['$\overline{x}$_1: ' num2str(bar1_vd),'$\overline{x}$_{2}: ' num2str(bar2_vd),'$\overline{x}$_{3}: ' num2str(bar3_vd)],['$\overline{x}$_{4}: ' num2str(bar4_vd),'$\overline{x}$_{5}: ' num2str(bar5_vd),...
'$\overline{x}$_{6}: ' num2str(bar6_vd)],['$\overline{x}$_{7}: ' num2str(bar7_vd),'$\overline{x}$_{8}: ' num2str(bar8_vd),'$\overline{x}$_{9}: ' num2str(bar9_vd),'$\overline{x}$_{10}: ' num2str(bar10_vd)]};
a7 = annotation('textbox',dim7,'String',strVDrift,'FitBoxToText','on',Interpreter='latex');

답변 (1개)

Star Strider
Star Strider 2022년 10월 25일
Use '$\bar{x}$' to get:
.
  댓글 수: 2
Dennis
Dennis 2022년 10월 25일
편집: Dennis 2022년 10월 25일
it did not work with my code...
and how can i then attach the subscript numbers?
Star Strider
Star Strider 2022년 10월 25일
It would help to have some of the numbers.
bar1_vd = rand;
bar2_vd = rand;
bar3_vd = rand;
bar4_vd = rand;
bar5_vd = rand;
bar6_vd = rand;
bar7_vd = rand;
bar8_vd = rand;
bar9_vd = rand;
bar10_vd = rand;
strVDrift = {['$\bar{x}_1: ' num2str(bar1_vd) '\bar{x}_{2}: ' num2str(bar2_vd),'\bar{x}_{3}: ' num2str(bar3_vd),'\bar{x}_{4}: ' num2str(bar4_vd),'\bar{x}_{5}: ' num2str(bar5_vd),...
'\bar{x}_{6}: ' num2str(bar6_vd),'\bar{x}_{7}: ' num2str(bar7_vd),'\bar{x}_{8}: ' num2str(bar8_vd),'\bar{x}_{9}: ' num2str(bar9_vd),'\bar{x}_{10}: ' num2str(bar10_vd) '$']};
text(0.1, 0.8, strVDrift, 'Interpreter','latex')
strVDrift = {['$\bar{x}_1: ' num2str(bar1_vd) '$' newline '$' '\bar{x}_{2}: ' num2str(bar2_vd) '$' newline '$' '\bar{x}_{3}: ' num2str(bar3_vd) '$' newline '$' '\bar{x}_{4}: ' num2str(bar4_vd) '$' newline '$' '\bar{x}_{5}: ' num2str(bar5_vd),...
'$' newline '$' '\bar{x}_{6}: ' num2str(bar6_vd) '$' newline '$' '\bar{x}_{7}: ' num2str(bar7_vd) '$' newline '$' '\bar{x}_{8}: ' num2str(bar8_vd) '$' newline '$' '\bar{x}_{9}: ' num2str(bar9_vd) '$' newline '$' '\bar{x}_{10}: ' num2str(bar10_vd) '$']};
text(0.1, 0.4, strVDrift, 'Interpreter','latex')
% a7 = annotation('textbox',dim7,'String',strVDrift,'FitBoxToText','on',Interpreter='latex');
I have no idea what you want to do, so I created two versions of the string.
I used text to test it, and used ‘\bar’ just to make sure it works.
.

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

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by