MATLAB中使用LaTex字符
clear
close all
clc
figure('Color',[1 1 1]);
x = 0:pi/1000:2*pi;
y = (sin(x)).^2;
z = cos(x)./2;
plot(x,y);
hold on;
plot(x,z);
text('Interpreter','latex','String',' $ x^{2}+y^{2}=z^{2} $', 'Position',[0.5 0.6],'FontSize',10);
xlabel('$$f(x) = \sum_{n=0}^{10} \frac{x}{n!}$$','Interpreter','LaTex');
ylabel('\(f(x)\)','Interpreter','LaTex');
h=legend(['test',sprintf('\n'),'$sin^{2}(x)$'],['test2', sprintf(' \n'),' $\frac{cos(x)}{2}$'],' location',' best');
grid on ;
set(h,'Box','on'); %off
set(h,'Fontsize' ,9);
set(h,'Interpreter','latex')
交互式的局部放大图
1.直接使用github上的工具
https://github.com/iqiukp/ZoomPlot-MATLAB
2.在原图上进行编辑
在原图上拷贝一个图出来,然后修改放大坐标区间。