I don’t know what the rest of your problem, so can’t say for sure what will work. But based on the portion shown,
variable p(n,n) symmetric % where n is whatever value is appropriate
p is a matrix, it makes no sense to have
trace(p(k+1)) as the objective function. Perhaps you want
I have no idea what you really intend for the constraint.
p(k+1) makes no sense. If
k is used in the constraint, it needs to have a numerical value, such as if it is the index of a for loop the constraint is specified in.
is there only one
p matrix? Or are there
num_k matrices, one for each value of k from 1 to
num_k ? And if so, are you only trying to minimize the trace of the kth matrix? if so, you might want
variable P(n,n,num_k) symmetric % each 2D slice p( :,:,k) is declared to be symmetric
And then the objective function and constraints would be in terms of
P(:,:,k) for whatever the relevant value(s) of
Perhaps you can carefully write out mathematically the optimization problem you want to solve. That is as much, or more, for your benefit, as for the benefit of forum readers trying to help you.