矩陣
如果您還沒有符號包,請下載它。從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