TP-traitement-audio-visuel/TP5/U.m

20 lines
363 B
Mathematica
Raw Normal View History

2023-06-22 18:47:16 +00:00
function energie = U(c, I_moyen, beta, gamma, S, R)
N = length(I_moyen);
Ui = 1 - 2 ./ ( 1 + exp( - gamma * (I_moyen / S - 1) ) );
delta = 0;
for i=1:N
for j=i+1:N
if norm(c(j,:) - c(i,:)) <= sqrt(2) * R
delta = delta + 1;
end
end
end
energie = sum(Ui) + beta * delta;
end