function [xCoup,yCoup] = PositionCoup(Difference) %UNTITLED Summary of this function goes here % Detailed explanation goes here v = size(Difference); xCoup = 0; yCoup = 0; SommeCoef=0; for i = 1 : v(1) for j = 1 : v(2) coef=Difference(i,j); xCoup = xCoup + i*coef; yCoup = yCoup + j*coef; SommeCoef= SommeCoef + coef; end end xCoup = xCoup/SommeCoef; yCoup = yCoup/SommeCoef; end