矩阵
如果您还没有符号包,请下载它。从Octave命令行或gui命令行。例如
octave> pkg install -forge symbolic
如果您安装了python和sympy,它会从八度锻造程序为您安装软件包。我用谷歌找出如何安装sympy,如果你需要帮助,请打我。
安装符号包后,使用“pkg load”导入包函数,然后使用syms函数声明符号。
octave> pkg load symbolic
octave> syms a b
这定义了符号a和b。
octave> syms
Symbolic variables in current scope:
a
b
“syms”本身将打印您定义的所有符号。
octave> mat = [a,b]
mat = (sym) [a b] (1×2 matrix)
octave:34> mat * 2
ans = (sym) [2⋅a 2⋅b] (1×2 matrix)
我发现这个软件包对我的机器人操纵器类的计算旋转矩阵很有帮助。希望这可以帮助。
下面是更多的例子我的脚本的一部分:
pkg load symbolic
syms psi phi theta psidot phidot thetadot
RzPsi = [[cos(psi), -sin(psi), 0]; [sin(psi), cos(psi), 0]; [0,0,1]]
RyTheta = [[cos(theta), 0, sin(theta)];[0,1,0];[-sin(theta), 0, cos(theta)]]
RzPhi = [[cos(phi), -sin(phi), 0]; [sin(phi), cos(phi), 0]; [0,0,1]]
RzPsi = (sym 3×3 matrix)
⎡cos(ψ) -sin(ψ) 0⎤
⎢ ⎥
⎢sin(ψ) cos(ψ) 0⎥
⎢ ⎥
⎣ 0 0 1⎦
RyTheta = (sym 3×3 matrix)
⎡cos(θ) 0 sin(θ)⎤
⎢ ⎥
⎢ 0 1 0 ⎥
⎢ ⎥
⎣-sin(θ) 0 cos(θ)⎦
RzPhi = (sym 3×3 matrix)
⎡cos(φ) -sin(φ) 0⎤
⎢ ⎥
⎢sin(φ) cos(φ) 0⎥
⎢ ⎥
⎣ 0 0 1⎦
octave> RzPhi * RyTheta
ans = (sym 3×3 matrix)
⎡cos(φ)⋅cos(θ) -sin(φ) sin(θ)⋅cos(φ)⎤
⎢ ⎥
⎢sin(φ)⋅cos(θ) cos(φ) sin(φ)⋅sin(θ)⎥
⎢ ⎥
⎣ -sin(θ) 0 cos(θ) ⎦
请了投票
不,我已经有符号包,但问题仍然存在。 – 2012-11-01 05:45:09
@Gryllida不幸的是,我有一段时间没有使用Octave,并没有那么快的计算出东西。我热烈推荐在[Octave邮件列表](https://mailman.cae.wisc.edu/listinfo/help-octave)上询问:那里有很多有帮助和有知识的人。 – 2012-11-01 11:35:07
“此”链接中的页面不存在。 – 2014-06-11 11:46:16