17 lines
422 B
Mathematica
17 lines
422 B
Mathematica
|
function estimation = moindres_carres_bis(d, y, bords_g, beta_0, bords_d, gamma_0)
|
||
|
|
||
|
x = [bords_g ; bords_d];
|
||
|
|
||
|
F = x - [beta_0 * bernstein2(0, d, y) ; gamma_0 * bernstein2(0, d, y)];
|
||
|
|
||
|
E_block = zeros(length(y), d);
|
||
|
for i=1:d
|
||
|
E_block(:,i) = bernstein2(i, d, y);
|
||
|
end
|
||
|
|
||
|
E = [E_block(:,1:d-1) zeros(length(y), d-1) E_block(:,d) ; zeros(length(y), d-1) E_block];
|
||
|
|
||
|
estimation = E \ F;
|
||
|
|
||
|
end
|