Problem introduction
I have a simple system of 4 linear equations with 4 unknowns, which can be written as . The content of the matrices is written out below. The analytical solution to this equation is
Observation
Asking MATLAB R2017b to solve this system using mldivide returns the exact answer. However, MATLAB R2024a returns a slightly different answer for the exact same question, where 3 out of the 4 elements in x are off to the order of 1e-11.
This exact observation can be reproduced using the attached files.
The run in R2017b (err is the difference between the mldivide solution and the analytical solution):
>> test
x =
1.0e+02 *
0.010000000000000
0
-2.865785081173561
0.687432906991598
err =
0
0
0
0
The run in R2024a:
>> test
x =
1.0e+02 *
0.010000000000097
0.000000000000000
-2.865785081173561
0.687432906991647
err =
1.0e-11 *
0.972688596334592
0.004821862926227
0
0.484590145788388
Question
Simply; how come?
Is it simply a numerical error? What is the difference in mldivide between R2017b and R2024a? I read in the release notes that there is an Improved performance with small matrices to mldivide in R2022b. Is this the cause?
And how can I overcome this issue? A lot of my test functions are failing; is there a proper, robust fix for this? Or should I take a close look at my failing test functions and update them if possible? Any other suggestions?