Hello guys. I want to minimize the deviation from the desired value, of all diagonal elements of a matrix. To be clear i have a matrix A(5x5x3). For each third dimension i want to minimize the expression |aii-1|, thus i want all diagonal elements for each third dimension to be as closes as possible to 1. I thought to put the expression x(i)==trace(abs(A(:,:,i)-1) i=1,2,3 , in constraints and minimize sum(x), but i took an error. If i put directly to minimize trace(abs(A(:,:,1)-1) its ok but i cant do it for all i=1,2,3,..... Is there any way to solve my problem?
I would appreciate any help!!