在下面的代码中,我尝试将8个符号矩阵存储在MatRot
中:
MatRot = zeros(4,4,8);
pkg load symbolic
theta = sym('theta',[1 8]);
d = sym('d',[1 8]);
alpha = sym('alpha',[1 8]);
a = sym ('a',[1 8]);
for i=1:8
MatRot(:,:,i) = [[cos(theta(1,i)), -cos(alpha(1,i))*sin(theta(1,i)), sin(alpha(1,i))*sin(theta(1,i)), a(1,i)*cos(theta(1,i))];
[sin(theta(1,i)), cos(alpha(1,i))*cos(theta(1,i)), -sin(alpha(1,i))*cos(theta(1,i)), a(1,i)*sin(theta(1,i))];
[0, sin(alpha(1,i)), cos(alpha(1,i)), d(1,i)];
[0, 0, 0, 1]];
end
但是Octave给了我下一个错误:
error: operator =: no conversion for assignment of 'class' to indexed 'matrix'
error: called from
SymbolicMatRot at line 14 column 17
我发现在MATLAB中,我可以像这样创建符号多维数组:
A = sym('a',[2 2 2])
A(:,:,1) =
[ a1_1_1, a1_2_1]
[ a2_1_1, a2_2_1]
A(:,:,2) =
[ a1_1_2, a1_2_2]
[ a2_1_2, a2_2_2]
但是Octave出现此错误:
error: Cannot create symbolic matrix with that size
error: called from
assert at line 94 column 11
make_sym_matrix at line 23 column 3
sym at line 328 column 9
我不知道要存储这种表格。
我正在使用WinNU和GNU Octave版本:4.4.1和Symbolic版本2.7.1