help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I store Symbolic matrix?


From: r1f1
Subject: How do I store Symbolic matrix?
Date: Thu, 22 Nov 2018 15:48:47 -0600 (CST)

In the code below I try to store the 8 symbolic matrix in 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/

But octave give me the next error:

/error: operator =: no conversion for assignment of 'class' to indexed
'matrix'
error: called from
    SymbolicMatRot at line 14 column 17/

I found that in matlab I can create a Symbolic Multidimensional Arrays like
this:

/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]/

But octave give this error:

/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/

I don't know another form to store this. I'm using win7 with GNU Octave
Version: 4.4.1 and symbolic version 2.7.1





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]