matlab 中采用latex规则绘图 实例

本文介绍了如何在Matlab中使用LaTeX规则创建图表,包括图例位置调整、保存为eps和pdf格式,设置坐标轴标记和marker。通过实例展示了两个方法的MSE与SNR的关系,并详细设置了图例和坐标轴标签以符合LaTeX格式。
摘要由CSDN通过智能技术生成

matlab 中采用latex规则绘图 实例

包括图例legend位置、保存eps与pdf格式、设置坐标轴符号标记和marker

 


MSE01=[7.72229711747046e-05;7.65300431902911e-05;7.57162354692778e-05;7.48410770667595e-05;7.36007497719152e-05;7.20998042296743e-05;
    7.02059057175177e-05;6.79171008226705e-05;6.57162479872416e-05;6.30361791705213e-05;5.94029924187517e-05;5.59010467279637e-05;
    5.19812432117656e-05;4.68091989196220e-05;4.25073404891431e-05;3.66194010566225e-05;3.04569016218451e-05;2.53959231624822e-05;
    2.08089409650163e-05;1.56986726955633e-05;1.32146688889754e-05;1.07772448491204e-05;8.20387977608786e-06;6.40118270641624e-06;
    4.68129344349216e-06;3.23617049074121e-06;2.29227963773454e-06;1.60267967053858e-06;9.33517023866733e-07;7.72826508205794e-07;
    6.88483955204324e-07];
MSE02=MSE01*0.85;
SNR=1:31;


%% plot
figure
d1=426*1.4;
d2=d1*0.63;
p1=1440/2-d1/2;
p2=900-300-d2;
set(gcf,'position',[p1,p2,d1,d2]);

thisR=[236 31 36]/255;
thisG=[12 153 71]/255;
thisB=[57 82 164]/255;
thisZi=[184 82 159]/255;
thisJu=[247 208 189]/255;
thisK=[0.05 0.05 0.05 ];

LineWidthValue=1.2;
MarkerSizeValue=4;
idxPart1=1:31;
idxPart2=1:31;

L1=semilogy(SNR,MSE01,'-o','color',thisR,'LineWidth',LineWidthValue ,'MarkerSize',MarkerSizeValue,'MarkerIndices',idxPart1,'MarkerFaceColor','w');
hold on
L2=semilogy(SNR,MSE02,'-.s','color',thisB,'LineWidth',LineWidthValue ,'MarkerSize',MarkerSizeValue+1,'MarkerIndices',idxPart2,'MarkerFaceColor','w');
hold  on
line([SNR(15) SNR(15)],[1e-7  1e-4],'color',[0.1 0.1 0.1],'LineWidth',1)

xlim([.5 31.5])
ylim([1e-7  1e-4])
lgd=legend([L1 L2],{'Proposed method 1','Proposed method 2'} );
g1=0.28;
g2=0.185;
g3= 0.1;
g4=0.1;
set(gca,'TickLabelInterpreter','latex');
set(lgd,'Position',[g1,g2,g3,g4],'interpreter','latex','Fontname','Times New Roman','Fontsize',14);
set(gca,                                               'Fontname','Times New Roman','Fontsize',10+4);
ylabel('$\rm{MSE}$',             'interpreter','latex','Fontname','Times New Roman','FontSize',10+4)
xlabel('$\rm{SNR \ (dB)}$',      'interpreter','latex','Fontname','Times New Roman','FontSize',10+4);%'Century'
h = gca;
% % set(gca,'XTick',SNR([ 1 7  14  21 28]));
% % set(gca,'Xticklabel',{1 2 3 4 5});       
% % set(gca,'YTick',MSE01([28 21 14 7 1]));
% % set(gca,'Yticklabel',{'$0$','${m_{\pi_1}}$','${m_{\pi_2}}$','${m_{\pi_3}}$','${m_N}$'});
grid on
box on

picName=sprintf('performance_0801.eps');
set(gcf,'Units','Inches');
pos = get(gcf,'Position');
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
%     saveas(gcf,picName,'psc2')

picName=sprintf('performance_0801.pdf');
set(gcf,'Units','Inches');
pos = get(gcf,'Position');
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
saveas(gcf,picName)
% set(gcf, 'PaperPosition', [0.75 0.2 26.5 26]);  不要这个
%     fig=gcf;
%     fig.Position


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>