将 Mathematica 方程导出到 Matlab

Export Mathematica equations to Matlab

我在 Mathematica 中做了一些符号计算,想将结果传输到 MATLAB,即将 Mathematica 计算的输出导出为有效的 MATLAB 语法。

有人建议 question on mathematica.stackexchange which asks the same thing, but the accepted answer is too limited for what I want. Specifically, the ToMatlab 软件包。

我需要一个类似的包,它不会有相同的缺陷,比如不处理 atan2

那么,有人知道 ToMatlab 包的有效替代方案吗?

如果您检查 'ToMatLab.m',您将看到三角函数的简单文字转换。只需添加您的功能,看看它是否有效。

ToMatlabaux[Sin] = "sin"
ToMatlabaux[Cos] = "cos"
ToMatlabaux[Tan] = "tan"
ToMatlabaux[Cot] = "cot"

ToMatLab 包实际上是一小段代码。