更新时间2018-05-07 23:59:39
matlab中符号表达式很长,r将其转换为latex如下
Req13 =
frac{2, {mathrm{Ra}}^2, {mathrm{Rd}}^2 + 2, {mathrm{Rd}}^2, {mathrm{Rf}}^2 + 2, mathrm{Ra}, mathrm{Rb}, {mathrm{Rd}}^2 + 6, {mathrm{Ra}}^2, mathrm{Rb}, mathrm{Rd} + 4, {mathrm{Ra}}^2, mathrm{Rb}, mathrm{Re} + 8, mathrm{Ra}, mathrm{Rb}, {mathrm{Rf}}^2 + 4, {mathrm{Ra}}^2, mathrm{Rb}, mathrm{Rf} + 4, mathrm{Ra}, {mathrm{Rd}}^2, mathrm{Re} + 4, {mathrm{Ra}}^2, mathrm{Rd}, mathrm{Re} + 8, mathrm{Ra}, mathrm{Rd}, {mathrm{Rf}}^2 + 6, mathrm{Ra}, {mathrm{Rd}}^2, mathrm{Rf} + 4, {mathrm{Ra}}^2, mathrm{Rd}, mathrm{Rf} + 2, mathrm{Rb}, {mathrm{Rd}}^2, mathrm{Re} + 2, mathrm{Rb}, mathrm{Rd}, {mathrm{Rf}}^2 + 2, mathrm{Rb}, {mathrm{Rd}}^2, mathrm{Rf} + 4, mathrm{Rb}, mathrm{Re}, {mathrm{Rf}}^2 + 4, mathrm{Rd}, mathrm{Re}, {mathrm{Rf}}^2 + 2, {mathrm{Rd}}^2, mathrm{Re}, mathrm{Rf} + 8, mathrm{Ra}, mathrm{Rb}, mathrm{Rd}, mathrm{Re} + 14, mathrm{Ra}, mathrm{Rb}, mathrm{Rd}, mathrm{Rf} + 12, mathrm{Ra}, mathrm{Rb}, mathrm{Re}, mathrm{Rf} + 12, mathrm{Ra}, mathrm{Rd}, mathrm{Re}, mathrm{Rf} + 6, mathrm{Rb}, mathrm{Rd}, mathrm{Re}, mathrm{Rf}}{3, {mathrm{Ra}}^2, mathrm{Rd} + 2, {mathrm{Ra}}^2, mathrm{Rf} + 2, mathrm{Re}, {mathrm{Ra}}^2 + mathrm{Ra}, {mathrm{Rd}}^2 + 7, mathrm{Ra}, mathrm{Rd}, mathrm{Rf} + 4, mathrm{Re}, mathrm{Ra}, mathrm{Rd} + 4, mathrm{Ra}, {mathrm{Rf}}^2 + 6, mathrm{Re}, mathrm{Ra}, mathrm{Rf} + {mathrm{Rd}}^2, mathrm{Rf} + mathrm{Re}, {mathrm{Rd}}^2 + mathrm{Rd}, {mathrm{Rf}}^2 + 3, mathrm{Re}, mathrm{Rd}, mathrm{Rf} + 2, mathrm{Re}, {mathrm{Rf}}^2}
复制源码到Mathtype中出现下面警告
有没有大神知道如何将matlab中很长的符号表达式用我们书本上的公式表示法在word中展示?
方法1
该方法是利用MATLAB自带的latex函数。
1、首先在得到需要输出的表达式f,
2、然后调用【latex】函数。即latex(f)。就得到latex语法的表达式
3、复制该语法表达式,粘贴到【mathtype】中,就得到了直观的公式。
如下图
END方法2
该方法针对的是方法一所不能解决的问题。比如说,在推导公式中有下标。但是在MATLAB中我们通常写出a1 ,这样是没有下标的。但是在word中书写的时候,需要变成下标。
首先使用方法一得到latex语法的表达式。
然后通过替换的方法【x_1】替换掉【x1】,【y_1】替换掉【y1】。
再把得到的结果粘贴到mathtype中就可以了。结果如下图
END
方法3
该方法是利用mathtype的公式源码编辑功能,比较适合前两种方法都不能很好解决你的问题的时候。
例如当我有一个向量,每个元素都是比较复杂的公式时,如下图所示。
怎样方便的得到右边的显示结果?
1、把要整理的内容复制到【mathtype】中,保存好,如下图
2、【单击】选中公式,点击mathtype中的【toggle tex】,就得到该公式的【源码】,如下图所示:
ps:可以对【多个公式】同时都变成【源码】格式,一次性修改。
3、根据方法二对源码进行【变量替换】,替换完成后,再次点击【toggle tex】,如下图
4、就得到所需的结果,但是字体还需要修改,【全选】,选择【样式】--【数学】。就得到了整齐的公式。
这样处理是不是非常方便,再也不怕MATLAB中复杂的公式导入word了。