补充讲义:Matlab 与Latex

Download Report

Transcript 补充讲义:Matlab 与Latex

数学软件 Matlab
—— Matlab 与 Latex
1
主要内容
 将符号计算的结果输出到 Latex
 Matlab 做图加入数学公式
2
符号计算与 Latex
latex(符号表达式)
syms x
f=diff(sqrt(x))
latex(f)
H=sym(hilb(3))
latex(H)
3
Matlab 做图与 Latex
 Matlab 做图时可使用 text 命令在任意指定的地方放置文本
text(x,y,string,properties)
syms x
f=exp(sqrt(x)+2*x)
ezplot(f,[0,1])
text(0.5,subs(f,x,0.5)+6,'exp(sqrt(x)+2x)')
text(0.5,subs(f,x,0.5)+6,'exp(sqrt(x)+2x)', ...
'FontSize',12)
详细用法见: doc text  Text Properties
4
Matlab 做图与 Latex
 如果需要输入数学符号或数学公式,可以使用 text 命令的
interpreter 属性
syms x
f=exp(sqrt(x)+2*x)
ezplot(f,[0,1])
text(0.5,subs(f,x,0.5)+6, ...
'$e^{\sqrt{x}+2x}$', 'interpreter','latex')
5