Producing Matrix with zero determinant with ode45

3 次查看(过去 30 天)
I have a ode solver that uses ode45 to solve an ode with an intial state that consists of 18 variables. When I use a specific combination of initial values, I somehow produce a Euler rotation matrix that has a zero determinant which breaks the solver as I later use that matrix to solve a system of equations ie I have a line that does something like
vector1 = euler\vector2
The euler rotation matrix is computed like this
Rocket.EulerRotMat = [
1 0 -sind(ElevAngle);
0 cosd(RollAngle) cosd(ElevAngle)*sind(RollAngle);
0 -sind(RollAngle) cosd(ElevAngle)*cosd(RollAngle)];
So what I do is view the variable and copy all the 16 digits of each of the 18 initial conditions and plug that into the solver. When I do it this way, it seems I don't produce a zero determinant. What is somewhat interesting is that the difference between the copied value and the actual value that MATLAB plugs in has a difference of 10^-16. What is also interesting is that for the two different runs (one that worked and one that broke), all the position values and velocity values (x,y,z) plus those relating to pitch that the solver computed are basically the same (mind some tiny differences in decimal places) except for those that pertain to the roll and yaw (makes sense as the euler rotation matrix doesn't work). For example, this graph shows roll velocity vs time where the blue line came from me manually copying the 16 digits of each value into the solver and the orange line came from MATLAB's internal value which broke the solver, hence the line is shorter. What somewhat makes no sense to me is how that a difference of 10^-16 for each of the 18 variables can cause it to diverge so much.
  2 个评论
David Goodmanson
David Goodmanson 2021-2-4
Hello WS,
That does not look like a good rotation matrix at all. It's supposed to be an orthonormal matrix, but if you take the dot product of, say, column 1 and column 3 you don't get zero.
Wei Yang Shen
Wei Yang Shen 2021-2-4
Now that you mentioned it, it seems that I may need to double check if the physics was implemented correctly.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by