how to insert numerical derivative in function for ode integration

9 views (last 30 days)
Hi all,
I computed the traslation dinamics of a re-entry trajecotry.
Now I am adding the attitude , but I have this problem :
from the quaternions (that I compute after found the traslation dynamics) I have to compute the derivative of quaternion, that I will use in the equation of attitude that I will write in the same function ("equation_moto").
In order to find derivate of quaternion, I am using fnite difference, but as far I understood I needed of 2 values in order to compute the "difference", but in ode integration at each step I comput only 1 ( istant value).
I implemented this part, in function "equation_moto", at lines 272-274
%% derivative quaternion
% dq0_c2 = q0_c - q0_c() / t -
dq0_c = diff(c)/diff(t);
dq1_c = diff(q1_c)/diff(t);
dq2_c = diff(q2_c)/diff(t);
dq3_c = diff(q3_c)/diff(t);
Putting a debug point I see that the dq(i) values are empty.
I need to compute the derivatives of quaternions, I found quaternions in the line 260-263.
Once that I have all the parameters I can write the equations in order to integrate also the error different in attitude and angular velocity
someone can help me ?,
many thank for your time and help
kind regards
  4 Comments
James Tursa
James Tursa on 13 Aug 2020
So, if you already have the attitudes because you have a list of time tagged quaternions, why are you trying to integrate the quaternion derivatives to come up with what you already have? If you did it exactly, won't this just reproduce your time tagged quaternion list? Can't you just interpolate your quaternions to get them at a different time? I am still not following your problem.
Do you need the body rate information for some reason?
Alessandro Vitiello
Alessandro Vitiello on 14 Aug 2020
Yes, I have to compute the angular velocity.
But from cinematic relationship I need quatertions (I have them) and derivative of quaternions (that I do not have).
So I was thinking to compute derivative of quaternion , from quaternion using finitive difference

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!