天天看点

Matlab画图导出Latex论文插图

f=figure;

subplot(2,1,1);
plot(t,zeros(1,1001),'k:','LineWidth',1.2);%参考值用黑色点线
hold on
plot(t,xn,'--','LineWidth',1.2);%用虚线,线粗一点
hold on 
plot(t,x,'LineWidth',1.4);%重要的数据用实线,线粗一点
legend('$x_{r}$','$x_n$','$x$','Interpreter','latex')%这样出来的字体是latex字体
axis([0 10 -0.1 0.3]);
xlabel('$Time(s)$','Interpreter','latex');ylabel('$x$','Interpreter','latex');

subplot(2,1,2);
plot(t,zeros(1,1001),'k:','LineWidth',1.2);
hold on
plot(t,[un un(1000)],'--','LineWidth',1.2);
hold on
plot(t,[u u(1000)],'LineWidth',1.4);
legend('$u_{r}$','$u_n$','$u$','Interpreter','latex');
axis([0 10 -0.5 0.5]);
xlabel('$Time(s)$','Interpreter','latex');ylabel('$u$','Interpreter','latex');


print(f,'Evolution','-depsc','-r600'); % 设置图片格式、分辨率
savefig(f,'Evolution.fig')
           

效果

Matlab画图导出Latex论文插图

 也可以在图窗里打开属性编辑器进行修改,感觉改完效果好点

Matlab画图导出Latex论文插图

修改完选择另存为eps格式,在latex中使用代码添加图片

\begin{figure}
    \centering
    \includegraphics[width=0.5 \textwidth]{Evolution.eps}
    \caption{Evolution}
\end{figure}
           

latex文档开头要添加包

\usepackage{graphicx}
\usepackage{epstopdf}
           

继续阅读