TP-traitement-audio-visuel/TP2/calcul_VC_bis.m

19 lines
410 B
Mathematica
Raw Normal View History

2023-06-22 18:47:16 +00:00
function VC = calcul_VC_bis(D_app,beta_0,beta_d,d,lambda)
X = D_app(1,:)';
Y = D_app(2,:)';
n = length(X);
VC = 0;
for j=1:n
D_app_loo = [D_app(:,1:j-1) , D_app(:,j+1:n)];
beta = moindres_carres_ecretes(D_app_loo, beta_0, beta_d, d, lambda);
estimation = bezier(beta_0, beta, beta_d, X(j));
VC = VC + (Y(j) - estimation).^2;
end
VC = VC/n;
end