27 lines
649 B
Matlab
27 lines
649 B
Matlab
function parametres_MV = max_vraisemblance_2(D_app, parametres_test, sigma)
|
|
|
|
nb_tirages = length(parametres_test);
|
|
|
|
pi_1 = 0.5;
|
|
pi_2 = 0.5;
|
|
|
|
sigma_1 = sigma;
|
|
sigma_2 = sigma;
|
|
|
|
p_1 = parametres_test(:,1,:);
|
|
p_2 = parametres_test(:,2,:);
|
|
|
|
R = zeros(nb_tirages, 1);
|
|
for i=1:nb_tirages
|
|
R(i, 1) = sum( log( ...
|
|
pi_1/sigma_1 * exp(- calcul_r(D_app, p_1(i,:)).^2 / 2 / sigma_1.^2) ...
|
|
+ pi_2/sigma_2 * exp(- calcul_r(D_app, p_2(i,:)).^2 / 2 / sigma_2.^2) ...
|
|
) );
|
|
end
|
|
|
|
[~, index] = max(R(:,1));
|
|
parametres_MV = [ p_1(index,:) ; p_2(index,:) ];
|
|
|
|
end
|
|
|