MATLAB latex 拼接

syms x y
f = y*sin(x)-x*cos(y);
fsurf(f,[-2*pi 2*pi])
a = gca;
a.TickLabelInterpreter = "latex";
 
S = sym(a.XLim(1):pi/2:a.XLim(2));
S = sym(round(S/pi*2)*pi/2);
xticks(double(S));
labels = "$" + arrayfun(@latex,S,UniformOutput=false) + "$";
xticklabels(labels);
 
S = sym(a.YLim(1):pi/2:a.YLim(2));
S = sym(round(S/pi*2)*pi/2);
yticks(double(S))
labels = "$" + arrayfun(@latex,S,UniformOutput=false) + "$";
yticklabels(labels);
 
xlabel("$x$",Interpreter="latex");
ylabel("$y$",Interpreter="latex");
zlabel("$z$",Interpreter="latex");
titletext = "$" + latex(f) + "$ for $x$ and $y$ in $[-2\pi,2\pi]$";
title(titletext,Interpreter="latex")

  

感谢 https://www.cnblogs.com/sunny99/ sumoier对本文的帮助!

posted @ 2024-02-01 13:13  20岁博客少女  阅读(6)  评论(0编辑  收藏  举报