TP-traitement-audio-visuel/TP1/calcul_VC.m
2023-06-22 20:47:16 +02:00

17 lines
384 B
Matlab

function VC = calcul_VC(D_app, beta_0, beta_d, d)
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(D_app_loo, beta_0, beta_d, d);
estimation = bezier(beta_0, beta, beta_d, X(j));
VC = VC + (Y(j) - estimation).^2;
end
VC = VC/n;
end