Coupled Matrix Differential Equations - Quaternions
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Torsten
am 23 Apr. 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!