MATLAB overdetemined linear system error: "Matrix dimensions must agree" -
i'm trying rather simple, can't code work. have 17 lines 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 try solving system x = a\b
i following error: error using \ matrix dimensions must agree.
well of course dimensions not add because overdetermined system, how can solve this?
how solve this: f3=a_0+ a_1*f1+a_2*f2+a_3*f1*f2+a_4*f1²+a_5*f2²?
thanks in advance!
you cannot solve overdetermined system in general case. can find least-squares solution, x=(a'a)^-1 a' b
Comments
Post a Comment