在 Matlab 图注释中写 "latex command"

writing "latex command" in the Matlab figure comment

我在Matlab中有一个图,我想在图中写评论。 评论包括乳胶配方;例如,我想在我的图 $$ \vec{R} = 2 $$

上写这条评论

这是我搜索时找到的例子;

clear all;
close all;
clc;
figure
ms = 8;
fontSize = 18;
xx = 0:.1:1;
plot(xx,sin(xx))
xlabel('P_{fa}', 'fontsize', fontSize);
ylabel('P_{m}', 'fontsize', fontSize);

我希望它看起来像下面的附图:

注意:我在已经回答的最后一个问题中搜索,我发现我可以在图例,标题,轴...中写latex命令,但在图中写注释时不能。

非常简单:只需添加一个 text 对象并将其 'interpreter' 属性 设置为 'latex':

text(.3, .5, '$\vec R=2$', 'interpreter', 'latex', 'fontsize', fontSize)

text的前两个参数是坐标;根据需要更改它们。