```
H=randn(8,2,10);
cvx_begin
variable W(8,8,10);
expression M
expression N
for m=1:1:2
M=M+H(:,:,m)'*W(:,:,m)*H(:,:,m);
end
for n=3:1:10
N=N+H(:,:,n)'*W(:,:,n)*H(:,:,n);
end
maximize trace(N^(-1)*M)
subject to
norm(vec(W)) <= sqrt(P);
for i = 1:10
W(:,:,i) == semidefinite(8);
end
cvx_end
```

I get error like this

```
Error using cvx/mpower (line 11)
Disciplined convex programming error:
Matrix powers not permitted.
Error in maximize (line 20)
arg = evalin( 'caller', sprintf( '%s ', varargin{:} ) );
Error in test (line 21)
maximize trace(N^(-1)*M)
```

If I change the optimization as

```
maximize trace(M*N)
```

Then the error looks like

```
Error using cvx/mtimes (line 127)
Disciplined convex programming error:
Invalid quadratic form: must be a scalar.
Error in maximize (line 20)
arg = evalin( 'caller', sprintf( '%s ', varargin{:} ) );
Error in test (line 21)
maximize trace(N*M)
```

How Can I get rid of this problem when my optimization is

` maximize trace(N^(-1)*M)`