Add Bar over Letter x for mean value symbol
203 次查看(过去 30 天)
显示 更早的评论
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');
0 个评论
回答(1 个)
Star Strider
2022-10-25
Use '$\bar{x}$' to get:
.
2 个评论
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.
.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!