A=magic(5)A = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9>> ticinv(A)tocans = -0.0049 0.0512 -0.0354 0.0012 0.0034 0.0431 -0.0373 -0.0046 0.0127 0.0015 -0.0303 0.0031 0.0031 0.0031 0.0364 0.0047 -0.0065 0.0108 0.0435 -0.0370 0.0028 0.0050 0.0415 -0.0450 0.0111Elapsed time is 0.006097 seconds.>> ticB=eye(5);A\Btocans = -0.0049 0.0512 -0.0354 0.0012 0.0034 0.0431 -0.0373 -0.0046 0.0127 0.0015 -0.0303 0.0031 0.0031 0.0031 0.0364 0.0047 -0.0065 0.0108 0.0435 -0.0370 0.0028 0.0050 0.0415 -0.0450 0.0111Elapsed time is 0.008993 seconds.
Just a general question, shouldn't have been the other way round? inv(matrix) is supposed to be more computationally intensive than the \ operation.
Best Answer