equation expression problem
- To: mathgroup at smc.vnet.net
- Subject: [mg101431] equation expression problem
- From: Haibo Min <haibo.min at gmail.com>
- Date: Tue, 7 Jul 2009 05:06:14 -0400 (EDT)
Hi, everyone.
I am now conducting a simulation for spacecraft attitude control. In this
problem, q denotes the attitude which is expressed in quaternion, i.e.,
q={Vq,Sq}, where Vq is a vector consisting of the first three elements of q,
and Sq is a scalar which is the last element of q, so Vq=q[[1;;3]],
Sq=q[[4]]. The dynamics of the spacecraft consist of Vq , Sq, and q.
What I want to do is to express the dynamics by q alone, therefore, in
constructing the equation table, I used the following code:
eqns[n_Integer] /; Positive[n] := Table[{ Subscript[q, i][[1;;3]]'[t]==
"expression a ", Subscript[q, i][[4]]'[t]=="expression b", "expression c"==
" an expression including Subscript[q, i][t]" }, {i,n}]
but error occurs,
Part::take:cannot take positions 1 through 3 in q1.
part::partw:part of q1 does not exist...
It seems that mathematica does not know what q is and therefore can not take
its elements.
I know that I can change it into another expression like
Subscript[Vq, i]'[t] == "expression a "
Subscript[Sq, i]'[t] == "expression b "
Subscript[q, i][t] == Append[Subscript[Vq, i]'[t], Subscript[Sq, i][t]].
...
In another word, denote the dynamics by Vq and Sq as well as q respectively,
but it is not convenient.
Is there any suggestion?
Thanks in advance.
Best regards,
Haibo
- Follow-Ups:
- Re: equation expression problem
- From: Tomas Garza <tgarza10@msn.com>
- Re: equation expression problem