如何将nb公式转换成matlab公式

1. 下载Mathematica软件

下载教程:https://mp.weixin.qq.com/s/qyFb4Lm0TeEJ8zZuQRR1_g

2. Mathematica教程

Mathematica教程:https://zhuanlan.zhihu.com/p/78292797
Mathematica基础教程:https://blog.csdn.net/limiyudianzi/article/details/88061833
初步了解Mathematica:https://zhuanlan.zhihu.com/p/396265688
Wolfram Mathematica Tutorial Collection: Advanced Numerical Integration in Mathematica:https://library.wolfram.com/infocenter/Books/8504/#:~:text=The%20Mathematica%20function%20NIntegrate%20is%20a%20general%20numerical,estimates%20that%20satisfy%20user-specified%20precision%20or%20accuracy%20goals.
在这里插入图片描述
网站有很多学习资料。

学习笔记:
(1)定义函数
在 Wolfram 语言中,申明函数时参数名称后紧随下划线。
官网参考资料:https://www.wolfram.com/language/fast-introduction-for-programmers/zh/function-definitions/?compare=python
在这里插入图片描述
(2)if判断语句
语法1:If[ condition , t , f ]
如果 condition 计算为 True 给出 t,如果它计算为 False 给出 f。

语法2:If [ condition , t , f , u ]
如果 condition 计算既不为 True 也不为 False 给出 u。

(3)Monitor
Monitor[expr,mon]:将产生一个临时监控单元,在计算 expr 的过程中,此监控单元将显示 mon 的连续更新值。
在这里插入图片描述
图片来源:https://reference.wolfram.com/language/ref/Monitor.html
(4)Table
在这里插入图片描述
图片来源:https://reference.wolfram.com/language/ref/Table.html
(5)表达式的运算
https://reference.wolfram.com/language/tutorial/EvaluationOfExpressions.html#16334
(6)Heaviside Step Function
https://mathworld.wolfram.com/HeavisideStepFunction.html
海维赛德阶跃函数又称单位阶跃函数,是一个不连续函数。
定义:
在这里插入图片描述

3. 将Mathematica中的nb文件转换成matlab文件

把Mathematica推导出的公式转成matlab表达式的方法:https://www.douban.com/group/topic/77254450/?type=like&_i=2906475Y0wZziW
(1)先下载两个文件:
https://library.wolfram.com/infocenter/MathSource/577/
在这里插入图片描述
下载文件至安装软件目录下,比如:D:\Program Files\Wolfram Research\Mathematica\8.0\AddOns\Packages
(2)测试1:
在这里插入图片描述
输入:

Import["ToMatlab.m", "Package"]
ToMatlab[-B + Sin[x]]

toMATLAB语法:
在这里插入图片描述
测试2:
在这里插入图片描述
转换过程:
在这里插入图片描述

4. Mathematica导入matlab文件

https://reference.wolfram.com/language/ref/format/MAT.html
在这里插入图片描述
在这里插入图片描述
图片来源:http://matlink.org/#scripts-functions

5.利用 MATLink 实现两者的互通

参考:https://blog.sciencenet.cn/home.php?mod=space&uid=241374&do=blog&id=1047417
MATLink :http://matlink.org/
MATLink实例:http://matlink.org/examples/
MATLink官网文档:http://matlink.org/documentation/
在这里插入图片描述
Mathematica转matlab:
在这里插入图片描述
图片来源:http://matlink.org/documentation/

6.两者对比

在这里插入图片描述
图片来源:https://statanalytica.com/blog/matlab-vs-mathemtica/

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值