Pinv function returns different results compared with excel results

4 views (last 30 days)
I have a matrix and when I compute pinv function it returns a matrix which is different from excel results. I ve computed in excel with the formula pinv(A)=mmult(minverse(mmult(transpose(A),A)),transpose(A)) and it doesn't get me the same result. If someone can help me, I thank you in advance. I have a matrix A with 30 rows and 2 columns -503.53 -2239.87 -361.13 1601.04 -434.69 1933.57 -362.25 1606.48 -501.17 2218.78 -291.61 1284.09 -433.47 1921.17 -292.97 1292.78 -490.61 1890.80 -25.70 88.40 -422.84 1629.40 -26.83 93.80 -490.44 1887.40 42.14 -172.40 -422.81 1625.89 41.67 -169.74 -486.67 1979.66 325.03 -1334.26 -418.93 1703.06 324.11 -1327.47 -486.71 1976.08 392.26 -1603.51 -419.46 1702.87 390.45 -1595.21 -42.10 165.92 -369.57 1528.21 24.53 -110.26 -369.67 1527.57 -39.55 156.55 -303.70 1250.98 The pinv function from Matlab returns me the following matrix: first row 0.003114728 0.002116943 0.002686996 0.002133685 0.002868898 0.001518693 0.002527754 0.001584389 -0.003327449 -0.000406287 -0.002872429 -0.000391885 -0.003385408 6.80645E-05 -0.002945935 8.30031E-05 -0.001029962 0.000424029 -0.000909924 0.000488211 -0.001112603 0.000658725 -0.000962154 0.000674883 -0.000205195 -0.000239227 -0.000176264 -0.000262179 -0.000178534 -0.00030255 second row 0.000781338 0.000532217 0.000674059 0.000536318 0.000721997 0.000383836 0.000635639 0.00039974 -0.000770693 -9.62316E-05 -0.000665345 -9.2693E-05 -0.00078466 1.37668E-05 -0.000683047 1.73935E-05 -0.000217721 8.18759E-05 -0.000193032 9.73881E-05 -0.000237618 0.000134205 -0.000205576 0.000138209 -4.67899E-05 -3.46057E-05 -4.39698E-05 -4.01262E-05 -4.0528E-05 -5.39524E-05 and the resulting matrix from excel is: first row -0.000949 -0.000030 -0.000035 -0.000030 -0.000042 -0.000026 -0.000036 -0.000026 -0.000099 -0.000007 -0.000085 -0.000007 -0.000099 0.000006 -0.000086 0.000007 -0.000077 0.000049 -0.000066 0.000049 -0.000077 0.000060 -0.000067 0.000060 -0.000008 -0.000053 0.000002 -0.000053 -0.000007 -0.000045 second row -0.000229 0.000018 0.000022 0.000018 0.000024 0.000014 0.000021 0.000014 0.000008 0.000000 0.000007 0.000000 0.000008 -0.000001 0.000007 -0.000001 0.000014 -0.000010 0.000012 -0.000010 0.000014 -0.000012 0.000012 -0.000011 0.000001 0.000012 -0.000001 0.000012 0.000001 0.000009 They are very different and I don't know why is this happening
  1 Comment
Geoff Hayes
Geoff Hayes on 14 Oct 2015
Loghin - how different are the results between the two algorithms? Please provide some details and include an example.

Sign in to comment.

Answers (0)

Categories

Find more on Operating on Diagonal Matrices 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!