17 lines
240 B
Mathematica
17 lines
240 B
Mathematica
|
function X = moindres_carres(D_app)
|
||
|
|
||
|
x = D_app(1,:)';
|
||
|
y = D_app(2,:)';
|
||
|
|
||
|
A = [
|
||
|
[x.^2, x.*y, y.^2, x, y, ones(length(x), 1)] ;
|
||
|
[1, 0, 1, 0, 0, 0]
|
||
|
];
|
||
|
|
||
|
O = [ zeros(length(x), 1) ; 1 ];
|
||
|
|
||
|
X = A \ O;
|
||
|
|
||
|
end
|
||
|
|