Coupled Matrix Differential Equations - Quaternions

1 visualización (últimos 30 días)
Erin Hayes
Erin Hayes el 22 de Abr. de 2022
Comentada: Erin Hayes el 23 de Abr. de 2022
Hi! I am working on a project for a class where I must recreate the results of a paper of my choosing that relates to the course. I have chosen this paper: https://www.tandfonline.com/doi/abs/10.1080/00207170500079779 (downloadble PDF)
I am working on recreating the first graph shown in the paper (graph of qBarc(t)) and, to my understanding, I must solve a set of coupled matrix differential equations. I believe I am setting it up correctly but do not know why I keep getting errors. Here is the code I have written:
%% Numeric Formulas: Design Example 1
syms q1c(t) q2c(t) q3c(t) q4c(t)
% Parameter Values (rad/s)
a1=0.51;
a2=0.251;
a3=0.151;
omega1=0.182;
omega2=0.424;
omega3=0.827;
% Commanded Angular Velocity Vector (Rates)
w1c=a1*sin(omega1*t);
w2c=a2*sin(omega2*t);
w3c=a3*sin(omega3*t);
wc=[w1c;w2c;w3c];
% Command Rate Derivatives
wcDot=[a1*omega1*cos(omega1*t);a2*omega2*cos(omega2*t);a3*omega3*cos(omega3*t)];
% Skew Symmetric Matrices
omegac=-[0 -w3c w2c;w3c 0 -w1c;-w2c w1c 0];
% Defining Commanded Quaternions (non-constant in this example, need to find)
qc=[q1c(t);q2c(t);q3c(t)];
qBarc=[qc;q4c(t)];
% Initial Values
qBarc0=[0.2000;0.1000;0.4472;0.8660];
% Command Quaternion Kinematic Equations
qDotc=diff(qc);
q4Dotc=diff(q4c);
qBarcDot=[qDotc;q4Dotc];
ode1 = qDotc==0.5*omegac.*qc+0.5*q4c(t)*wc;
ode2 = q4Dotc==-0.5*wc'*qc;
qc0 =[qBarc0(1);qBarc0(2);qBarc0(3)];
qc40 = qBarc0(4);
conds=qBarc0;
odes = {ode1,ode2};
[qcSol(t),q4cSol(t)]=dsolve(odes,conds);
% ALTERNATIVE WAY USING ODE45
% ode1=@(t,qc)[qcDot;0.5*omegac.*qc+0.5*q4c(t)*wc];
% ode2=@(t,q4c)[q4Dotc;-0.5*wc'*qc];
% odes = {ode1,ode2};
%[qcSol(t),q4cSol(t)] = ode45(odes,[0 60],conds);
I am not sure what I am doing wrong and I have been looking into as much as I can but cannot seem to solve for qBarc(t). Please let me know if anyone has an idea how to solve for this I would greatly appreciate it!
  2 comentarios
Torsten
Torsten el 23 de Abr. de 2022
I doubt that the symbolic toolbox can handle a system of ordinary differential equations written out in the way you did (namely as matrix equation), e.g.
ode1 = qDotc==0.5*omegac.*qc+0.5*q4c(t)*wc;
My guess is that you will have to write the equations one by one.
Erin Hayes
Erin Hayes el 23 de Abr. de 2022
Thank you! Turns out I did have to do that and then solve them as regular coupled differential equations, thanks for the tip!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by