Solve Linear System with a Ill Conditioned matrix.
46 views (last 30 days)
Tiago Carvalho on 25 Aug 2022
I am working on my Master Thesis that consists in programming a 3D Multibody Simulator that solves kinematic and foward dynamic analysis, as a result I have matrices that are usually ill conditioned. In one of my lines of code I am trying to solve a linear system that follows the equation of Mq''=g, where M is an Inertia Matrix and g is a vector of forces and q'' is the accelerations that I use to start an iterative process.
From this iterative process I am able to calculate position and velocity of all bodies and the results I have are plaged with numerical instability and as a result I suspect that the culprit is this equation. Therefore my question is the following: Is there anything that I can do to improve the condition of my mass matrix? I have tried the following:
- Use Pinv, which uses SVD, but the results are not satisfactory;
- Tried to use Decomposition to once again see if the results were satisfatory but unsuccessfully;
- Tried to use lsqminnorm with a high tolerance factor, where I achieved my best results.
- Eliminated the first 7 rows and columns from the matrix and the 7 rows of the vetor which correspond to a body without movement or mas (ground) to try and improve the conditions unsucessfully ( this simplification would not change my results);
Other than this I have been reading all sort of articles and answers in this community, mainly answers from John D'Errico user, but I haven't found anything that helped me. In annex I put the example of one Inertial matrix and a vetor of forces that I use in one of my models.
EDIT: I also have been trying to use the regtools toolbox, mainly focusing on using Tikhonov regularization but currently I am having trouble in choosing an adequate method to choose the regularization parameter.
Ivo Houtzager on 25 Aug 2022
Edited: Ivo Houtzager on 25 Aug 2022
Please have look at the following regress function, see PBSID-Toolbox/regress.m at master · jwvanwingerden/PBSID-Toolbox · GitHub. This function uses the reglcurve and reggcv fucntions of the regtools toolbox to find the the regularization parameter using L-Curve or Generalized Cross Validation for the Tikhonov regularization or the Truncated SVD method.