Matrix numeric inversion, very bad conditioned
15 views (last 30 days)
Show older comments
I have a matrix
A= [-1.14420182157714e-05 3.97106112979063e-09 1.71528761347565e-09 3304.87922280846 -6.43946234919730;
3.97106112979063e-09 -7.42484390057452e-13 -5.95484638418163e-13 -0.618994914206821 5.75841022133480e-05;
1.71528761347565e-09 -5.95484638418163e-13 -2.57140914558130e-13 -0.495586332063353 0.000965957682109416;
3304.87922280846 -0.618994914206821 -0.495586332063353 -516040787150.579 51574737.9623166;
-6.43946234919730 5.75841022133480e-05 0.000965957682109416 51574737.9623166 3814318.88267676];
and i want to calculate the inverse matrix. This matrix is very bad contitioned.
Normal inv oder pinv function doesnt give a stable solution. Which functions can use?
Thank you!
0 Comments
Answers (2)
Bhanu Prakash
on 10 Oct 2023
Hi Martin,
I understand that you want to calculate the inverse of the matrix ‘A’.
For a square matrix to be invertible, it should be a full row rank that means the rank of the matrix is equal to the size of the matrix.
But the rank of the given matrix ‘A’ is 2, which is not equal to its size (8).
>> rank(A)
ans =
2
To get the inverse of the matrix, which corresponds to a manual calculation, you can use the ‘vpa’ function from the Symbolic Math Toolbox.
For more information on the above-mentioned functions, kindly refer to the following documentation:
For ‘vpa’ function:
For ‘rank’ function:
3 Comments
Torsten
on 10 Oct 2023
I guess that your model parameters depend on each other.
In the simplest case, imagine you want to determine two parameters a and b to fit a function of the form
y = (a+b)*x
Now this is a model with two parameters, but you can fit only one, namely (a+b).
So the model can be reduced to
y = c*x
with only one parameter c to be determined.
If you compute the Jacobian of the "overdetermined" model in a and b, you will see that it is singular.
Askic V
on 10 Oct 2023
I would also investigate if I can use SVD.
Please have a look at this material:
Walter Roberson
on 10 Oct 2023
Your array is sensitive enough that it matters that your text entries do not represent the full double precision values stored in the variables. When you use format long g to display a variable, it displays 15 significant digits, not the 16 (sometimes 17!) needed to fully resolve a decimal number to binary. For example the decimal value -0.495586332063353 (row 4 column 3) is displayed the same for -0.495586332063353 .* (1+(-4:4)*eps)
format long g
A= [-1.14420182157714e-05 3.97106112979063e-09 1.71528761347565e-09 3304.87922280846 -6.43946234919730;
3.97106112979063e-09 -7.42484390057452e-13 -5.95484638418163e-13 -0.618994914206821 5.75841022133480e-05;
1.71528761347565e-09 -5.95484638418163e-13 -2.57140914558130e-13 -0.495586332063353 0.000965957682109416;
3304.87922280846 -0.618994914206821 -0.495586332063353 -516040787150.579 51574737.9623166;
-6.43946234919730 5.75841022133480e-05 0.000965957682109416 51574737.9623166 3814318.88267676];
Ainv = inv(sym(A))
Ainvd = double(Ainv)
Ainv * A
Ainvd * A
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!