Add Bar over Letter x for mean value symbol

194 Ansichten (letzte 30 Tage)
Dennis
Dennis am 25 Okt. 2022
Kommentiert: Star Strider am 25 Okt. 2022
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');

Antworten (1)

Star Strider
Star Strider am 25 Okt. 2022
Use '$\bar{x}$' to get:
.
  2 Kommentare
Dennis
Dennis am 25 Okt. 2022
Bearbeitet: Dennis am 25 Okt. 2022
it did not work with my code...
and how can i then attach the subscript numbers?
Star Strider
Star Strider am 25 Okt. 2022
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.
.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by