Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have this matrix:

X       Y       X*Y     X^2     Y^2     Z
11,16   1,24    13,84   124,55  1,54    22,15
24,20   16,23   392,77  585,64  263,41  2,83
19,85   10,72   212,79  394,02  114,92  7,97
10,35   4,11    42,54   107,12  16,89   22,33
19,72   1,39    27,41   388,88  1,93    16,83
0,00    20,00   0,00    0,00    400,00  34,60
20,87   20,00   417,40  435,56  400,00  5,74
19,99   4,62    92,35   399,60  21,34   14,72
10,28   15,16   155,84  105,68  229,83  21,59
4,51    20,00   90,20   20,34   400,00  15,61
0,00    4,48    0,00    0,00    20,07   61,77
16,70   19,65   328,16  278,89  386,12  6,31
6,08    4,58    27,85   36,97   20,98   35,74
25,00   11,87   296,75  625,00  140,90  4,40
14,90   3,12    46,49   222,01  9,73    21,70
0,00    0,00    0,00    0,00    0,00    58,20
9,66    20,00   193,20  93,32   400,00  4,73
5,22    14,66   76,53   27,25   214,92  40,36
11,77   10,47   123,23  138,53  109,62  13,62
15,10   17,19   259,57  228,01  295,50  12,57
25,00   3,87    96,75   625,00  14,98   8,74
25,00   0,00    0,00    625,00  0,00    12,00
14,59   8,71    127,08  212,87  75,86   14,81
15,20   0,00    0,00    231,04  0,00    21,60
5,23    10,72   56,07   27,35   114,92  26,50
2,14    15,03   32,16   4,58    225,90  53,10
0,51    8,37    4,27    0,26    70,06   49,43
25,00   20,00   500,00  625,00  400,00  0,60
21,67   14,36   311,18  469,59  206,21  5,52
3,31    0,13    0,43    10,96   0,02    44,08

And I'm trying to solve it, starting by getting it's determinant (after fill it with "1", so it becomes a square matrix).

I tried using Octave, but I got:

error: det: invalid dense matrix type

And trying in MSExcel 2007 I got a value of zero, what is wrong (I don't know the answer, but I know it can't be zero).

Any idea how to solve it (preferable on the computer)?

--reformulating

I have the above 30 values for X, Y and Z, and I need to find the coeficients (a,b,c,d,e,f) for:

$z=a+bx+cy+dxy+ex^2+fy^2$

(the values for [a, b, c, d, e, f] need to work for all lines at the same time)

share|improve this question
4  
A 6x30 matrix does not have a determinant... You should probably review what a determinant is. –  Mariano Suárez-Alvarez Sep 20 '12 at 17:03
8  
If you fill with 1's, the new columns will be linearly dependent and the result will be zero. –  Ross Millikan Sep 20 '12 at 17:05
1  
To solve what? –  Mariano Suárez-Alvarez Sep 20 '12 at 17:08
2  
Look up "least squares", Tom. –  J. M. Sep 20 '12 at 17:16
3  
Tom, "solving the matrix" does not mean anything. What equations do you what to solve? It will probably be best if you explain what you want to do (in the question body, not in comments) –  Mariano Suárez-Alvarez Sep 20 '12 at 17:18

1 Answer 1

Determinants are defined only for square matrices. What you want is the least squares solution to an overdetermined system, $Ax = z$. You can solve this in octave by building the matrix $A = [1,x,y,xy,x^{2},y^{2} ]$, where $1,x,y,...$ are column vectors, and then using Octave's "backslash" to get $x = [a, b, c, d, e, f]^T$, $i.e.$ use $x = A \backslash z$. Octave is smart enough to figure out what you want when you enter an overdetermined system and solves the associated least squares problem efficiently by means of the $QR$ factorization of $A$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.