Producing Matrix with zero determinant with ode45

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

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.
Now that you mentioned it, it seems that I may need to double check if the physics was implemented correctly.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2021년 2월 3일

댓글:

2021년 2월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by