1
votes

I'm trying something rather simple, but can't get the code to work. I have 17 lines like this:

a1*F1 + a2*F2 = F3

A=[716 1184; 246 2222; 265 2179; 337 605; 288 628; 526 1918; 316 1311; 274 1704; 406 1864; 532 1859; 694 1294; 534 929; 405 951; 396 1302; 501 1334; 435 1614; 639 1388];

b=[2814 2822 3127 2730 2249 2582 1943 2032 2551 2609 2395 2514 2540 2334 2338 2573 2302];

When I try solving this system with x = A\b

I get the following error: Error using \ Matrix dimensions must agree.

Well of course the dimensions do not add up because it is a overdetermined system, how can I solve this?

How could I solve this: F3=a_0+ a_1*F1+a_2*F2+a_3*F1*F2+a_4*F1²+a_5*F2²?

Thanks in advance!

1

1 Answers

0
votes

You cannot solve an overdetermined system in general case. But you can find a least-squares solution, which is x=(A'A)^-1 A' b