# Sparse model optimization problem

I’m not sure what the 1,2 norm is, but presuming it can be handled by CVX, your problem should be easy to enter.

Have you read the CVX Users’ Guide http://web.cvxr.com/cvx/doc/ ? Presuming the 1,2 norm can be handled, you can enter this problem in CVX almost as you see it. If you read the Users’ Guide and try to input your problem to CVX but get stuck, then you can ask for help on your sticking point. If this is a homework problem, you’ll learn more by trying to do it yourself rather than getting a stranger on the internet to do it for you.

1,2 norm for the matrix P is equal to "norms(norms(P,2,2),1,1) ", my problem is how to define a loop for different k values () the summation on k ) in minimizaiton function.

You can use a for loop to build up expressions.
Something along the lines of the following, or you can rearrange it as you prefer.
I have written this presuming the superscript k matrices are the (:,:,k) entry of a d by N by K array. But if d varies for each k, as you imply, then I leave it to you to adapt the code to your circumstance.

Obj = 0
for k=1:K
Obj = Obj + square_pos(norm(D(:,:,k)W(:,:,k) - X(:,:,k),‘fro’))
end
Obj = 0.5
Obj + other terms
minimize(Obj)

Thank you for the help. I believe using expressions will work.