MINVERSE - Difference in result between EXCEL and MATLAB

Copper Contributor

Hi there,

 

I have a 19 by 19 matrix that I used MINVERSE to get the inverse of.

Then I checked it in MATLAB, and there was a reasonable difference in the solution?

Any ideas on why? 

The original matrix and then EXCEL and MATLAB solutions are below

 

Original Matrix

 

-10000000-10000000000
1-1000000000000-10000
01-10000000000000-100
001-100000000000000-1
0001-10000000-1000000
00001-100000000000-10
000001100000000-1000
000000-1100000100000
0000000-11-1000000000
0000000001-100-110000
0000000000110001100
-2763160000000137504626500940000-11119790000
00000003735320-2650094000-35761400000
0000000000280341200011119790-8219900
000000179412000-28034120035761401385295000
00-136300800000000-1708030000821990-628487
00000-1015400000170803000-138529507965880
000-16724400000000-10434500000628487
0000-247824500000001043450000-7965880

 

EXCEL Solution

-0.6848732240.215550.0231406220.001473723-0.000792684-0.0532033-0.05409617-0.07847283-0.189343749-0.0209157240.012304799-3.60373E-07-2.96818E-07-1.4772E-07-1.3587E-07-1.58964E-08-8.79372E-08-1.35515E-08-2.11483E-08
-0.422655569-0.4634730.0529622450.003618717-0.001472873-0.1119023-0.11378111-0.16500718-0.219533784-0.2149110630.025421414-1.4772E-07-1.45976E-07-3.71251E-07-2.85522E-07-3.62019E-08-1.85037E-07-3.04441E-08-4.45595E-08
-0.074893297-0.079286-0.126439740.1047377860.038273017-0.0376085-0.03839879-0.04657976-0.053035045-0.056706366-0.083049886-1.58964E-08-1.72817E-08-3.62019E-08-4.55989E-08-5.64063E-07-7.78311E-08-3.97412E-07-3.06191E-08
-0.042210009-0.045955-0.085608802-0.627285040.139326188-0.0099968-0.01073604-0.01800754-0.023576066-0.027170281-0.055444241-1.35515E-08-1.49078E-08-3.04441E-08-4.05297E-08-3.97412E-07-7.28031E-08-1.3955E-06-6.02535E-08
0.0869927850.0811490.023109153-0.01862488-0.0287019130.140290160.138673620.125225320.1160726250.1071820260.021963255-2.11483E-08-2.45031E-08-4.45595E-08-7.49578E-08-3.06191E-08-1.59207E-07-6.02535E-08-3.35321E-07
0.3745582140.350260.1092444390.003160031-0.009015838-0.40357040.589668940.533572860.4954759510.4582322510.100432211-8.79372E-08-1.01991E-07-1.85037E-07-3.12667E-07-7.78311E-08-6.65831E-07-7.28031E-08-1.59207E-07
-0.474781577-0.437239-0.065337586-0.003185940.0035923980.18935610.19253082-0.72053033-0.661609025-0.603649039-0.0456160141.3587E-071.57741E-072.85522E-074.84577E-074.55989E-083.12667E-074.05297E-087.49578E-08
-0.297199859-0.215185-0.025047158-0.001492010.0010012240.06172590.062761480.09106204-0.705337622-0.047451433-0.0144685962.96818E-075.45068E-071.45976E-071.57741E-071.72817E-081.01991E-071.49078E-082.45031E-08
-0.315126776-0.21555-0.023140622-0.001473720.0007926840.053203280.054096170.078472830.1893437490.020915724-0.0123047993.60373E-072.96818E-071.4772E-071.3587E-071.58964E-088.79372E-081.35515E-082.11483E-08
-0.017926917-0.0003660.0019065361.8286E-05-0.00020854-0.0085226-0.00866531-0.01258921-0.1053186290.0683671570.0021637976.35555E-08-2.4825E-071.74436E-09-2.18709E-08-1.38535E-09-1.40537E-08-1.35626E-09-3.35482E-09
-0.102562855-0.0992890.01237534-0.00043278-0.002119525-0.0774538-0.07874971-0.11446249-0.118857191-0.1814398990.0201945991.185E-08-1.17652E-088.57285E-08-1.99055E-07-9.39695E-09-1.2763E-07-1.00856E-08-3.03982E-08
0.5505484890.5704550.7643158210.1015777540.0472888550.365961910.371932270.419847380.4514890030.4850613840.8165179037.20409E-088.47092E-081.48835E-072.67068E-07-4.86232E-075.88E-07-3.24609E-071.28588E-07
-0.129202794-0.127104-0.108717955-0.60866016-0.8319719-0.150287-0.14940966-0.14323285-0.13964869-0.134352307-0.0774074967.59676E-099.59533E-091.41154E-083.44281E-08-3.66793E-078.64042E-08-1.33525E-062.75068E-07
-0.177581717-0.222054-0.040290428-0.001693930.0025911750.127630210.129769340.188407630.043728597-0.556197606-0.031147418-1.60948E-07-3.87327E-071.39547E-073.26836E-072.83171E-082.10676E-072.56219E-085.04547E-08
-0.262217655-0.320977-0.029821624-0.002144990.0006801890.058699030.059684940.086534350.0301900350.193995339-0.013116615-2.12653E-07-1.50842E-072.23531E-071.49652E-072.03055E-089.70993E-081.68926E-082.34113E-08
-0.100223363-0.0869790.043906853-2.5907E-05-0.00542344-0.2142143-0.21780024-0.18695747-0.166133074-0.1454167880.0548161974.79327E-085.57499E-081.00486E-071.71911E-07-3.22322E-08-3.53164E-07-3.22734E-08-8.42495E-08
-0.347762272-0.384187-0.820598015-0.10111907-0.039745891-0.0742938-0.07538232-0.11842742-0.166498739-0.1582046970.1084713-1.31824E-07-1.28694E-07-3.35049E-07-2.39924E-075.27861E-07-1.07205E-073.66968E-07-1.39405E-08
-0.287565429-0.269111-0.086135286-0.02178491-0.019686075-0.4561394-0.45099532-0.40834754-0.379403327-0.351050225-0.0784689566.6789E-087.74879E-081.40477E-072.37709E-074.7212E-085.06624E-071.25496E-08-1.76114E-07
-0.032683288-0.033331-0.040830939-0.26797718-0.10105317-0.0276117-0.02766275-0.02857223-0.029458979-0.029536085-0.027605645-2.34487E-09-2.37397E-09-5.75782E-09-5.06922E-09-1.66651E-07-5.028E-099.98087E-072.96345E-08

 

MATLAB Solution

-0.842340.0428730.0428730.002822-0.00134-0.09489-0.09649-0.13995-0.27114-0.100990.021776-4.15E-07-3.51E-07-2.86E-07-2.42E-07-2.94E-08-1.57E-07-2.49E-08-3.77E-08
-0.81841-0.897450.1025530.007007-0.00285-0.21668-0.22032-0.31951-0.42509-0.416140.049225-2.86E-07-2.83E-07-7.19E-07-5.53E-07-7.01E-08-3.58E-07-5.90E-08-8.63E-08
-0.11348-0.1216-0.12160.1050680.038139-0.04783-0.04879-0.06165-0.07308-0.07633-0.08073-2.94E-08-3.06E-08-7.01E-08-7.17E-08-5.67E-07-9.47E-08-4.00E-07-3.47E-08
-0.07466-0.08154-0.08154-0.627010.139213-0.01859-0.01947-0.03068-0.04043-0.04367-0.05349-2.49E-08-2.61E-08-5.90E-08-6.25E-08-4.00E-07-8.70E-08-1.40E-06-6.37E-08
0.0394920.0290610.029061-0.01822-0.028870.1277140.1258860.1066810.09140.0830290.02482-3.77E-08-4.09E-08-8.63E-08-1.07E-07-3.47E-08-1.80E-07-6.37E-08-3.40E-07
0.1773090.1339610.1339610.004849-0.0097-0.455790.5365680.4565650.3930210.3579350.112296-1.57E-07-1.70E-07-3.58E-07-4.46E-07-9.47E-08-7.52E-07-8.70E-08-1.80E-07
-0.17041-0.10348-0.10348-0.005790.0046530.269940.274468-0.6017-0.50352-0.44888-0.063922.42E-072.63E-075.53E-076.90E-077.17E-084.46E-076.25E-081.07E-07
-0.14159-0.04455-0.04455-0.002820.0015440.1029250.1046530.151813-0.624510.031673-0.023833.51E-075.99E-072.83E-072.63E-073.06E-081.70E-072.61E-084.09E-08
-0.15766-0.04287-0.04287-0.002820.0013410.0948950.0964880.139950.2711360.100986-0.021784.15E-073.51E-072.86E-072.42E-072.94E-081.57E-072.49E-083.77E-08
-0.016070.0016740.0016742.37E-06-0.0002-0.00803-0.00816-0.01186-0.104350.0693130.0020526.42E-08-2.48E-073.38E-09-2.06E-08-1.23E-09-1.32E-08-1.22E-09-3.16E-09
-0.011180.0009240.000924-0.00122-0.0018-0.05326-0.05415-0.07878-0.07139-0.134970.0146984.38E-081.98E-081.66E-07-1.37E-07-1.57E-09-8.76E-08-3.50E-09-2.08E-08
0.7092070.7444350.7444350.1002190.0478420.4079680.4146440.4817890.5338990.5657360.8069751.27E-071.40E-072.88E-073.74E-07-4.73E-076.57E-07-3.13E-071.45E-07
-0.11416-0.1106-0.1106-0.60879-0.83192-0.1463-0.14536-0.13736-0.13183-0.1267-0.078311.29E-081.48E-082.73E-084.46E-08-3.66E-079.30E-08-1.33E-062.77E-07
-0.02882-0.05893-0.05893-0.002970.003110.1670150.1698160.2464830.120996-0.48056-0.04009-1.09E-07-3.36E-072.70E-074.27E-074.11E-082.76E-073.63E-086.61E-08
-0.02393-0.05968-0.05968-0.004190.0015110.1217870.1238320.1795620.1539590.315158-0.02745-1.29E-07-6.85E-084.33E-073.11E-074.07E-082.01E-073.41E-084.85E-08
0.0068950.0304840.030484-0.00094-0.00505-0.18585-0.18896-0.14514-0.11049-0.090950.0483738.54E-089.27E-081.95E-072.44E-07-2.31E-08-3.06E-07-2.46E-08-7.30E-08
-0.70493-0.77584-0.77584-0.09806-0.04099-0.16886-0.17153-0.25787-0.35201-0.339810.129954-2.57E-07-2.52E-07-6.49E-07-4.81E-074.97E-07-2.64E-073.41E-07-5.16E-08
-0.13782-0.1049-0.1049-0.02307-0.01916-0.41649-0.41068-0.34988-0.30162-0.27491-0.087481.19E-071.29E-072.72E-073.39E-076.00E-085.72E-072.33E-08-1.60E-07
-0.03882-0.04006-0.04006-0.26792-0.10107-0.02924-0.02932-0.03097-0.03265-0.03266-0.02724-4.49E-09-4.49E-09-1.11E-08-9.22E-09-1.67E-07-7.72E-099.98E-072.90E-08
4 Replies

@GerNagle 

Some of the matrix entries have formulas that refer indirectly to column I.

Column I contains circular references, preventing the worksheet from being recalculated properly.

If you select P2:AH20, copy then paste as values to get rid of the formulas, the inverse matrix will be recalculated correctly and show the same result as MATLAB.

@Hans Vogelaar thank you for your reply, much appreciated. I got the matrix inverse to recalculate to be the same as MATLAB. At least for my own sanity, I'm glad I wasn't doing something completely wrong.

If I may, can I ask a further question. 

I do understand what you are saying as regards the column I, and the circular reference. What is continuing to confuse me is that the values in the I column eventually give the values in the matrix that I was trying to get the inverse of. The matrix is not backward dependent on them, it is taking the values from column M and F, so why is the column I causing this difference?

thanks you

Gerard

@GerNagle 

The formulas in the matrix refer to columns M and F.

The formulas in column M refer to columns E and K.

The formulas in column K refer to columns C, D and J.

The formulas in column J refer to column I.

So the matrix formulas refer indirectly to column I, the column with the circular references.

@Hans Vogelaar thank you for the reply.

I guess what I confused about is the circular reference.

If the formula in column I returns a numerical result, regardless of it been a circular reference, I don't understand how it propagates through to the matrix, as there is a numerical value

Reading around this, enabling iterative calculation seems like an option.

Thanks you for your time and expertise.

Gerard