function gradY = gradientYFromZ(gradAug, phi,  mu, nu, yExpected, y, params)

n = length(gradAug);
gradnu = 0;

for i = 1:n

    L = computeL(y{i});
    gradY{i} = phi{i} * gradAug{i} + ((mu / n) * 2 *(L' * L) * ( y{i} -  yExpected{i}'));

     % gradnu   =  nu/(n*size(y{i}, 2)) * ( 2 * (y{i} - yExpected{i}' ) * ones(size(y{i}, 2)));
%      gradnu1  =  nu/(n) * ( 2 * repmat(sum((y{i} - yExpected{i}' ), 2), 1, size(y{i}, 2)));
        gradnu1  =  nu * size(yExpected{i}, 1)/(n) * ( 2 * repmat(sum((y{i} - yExpected{i}' ), 2), 1, size(y{i}, 2)));

     gradY{i} = gradY{i} + gradnu1;
    
end


end