DearsI want to do minimization in CVX, but I got error minimize norm y-sum(Ai*xi*z) with given xit means I want to find A but because of practical material I need to calculate " i rows of matrix A " and then do multiplication in i th row of vector x and do it again.
A is a matrix 100*25 (unknown) y is a vector 25*1(known)x is a vector 25*1(known)z is a vector 25*1(known) so as I said I derive A1 by 25 rows of matrix A and then calculate A1*xi*z and do it four times and then adding them to find sum(Ai*xi*z) at final I want to minimize norm (y- sum(Ai*xi*z) )I do not know how to implant this in CVX because if I says my variable is A how can I implement it in minimization part ?I hope this help to know what am I saying and Thanks for helpregard
Can you write out your problem more clearly? Any mathematical operations, such as matrix and vector multiplication, which you want to do in CVX, have to make sense if all the variables were MATLAB variables and CVX were not involved at all. In particular, matrix and vector multiplications need to be "conformal", i.e., have properly matching dimensions.
So xi * z does not even make sense because a 25 by 1 vector can not be multiplied by a 25 by 1 vector. I can't tell you how to fix this, because I don't know what you are trying to do.
xi * z
xi is the i th element of vector x.
Pretend that you are not using CVX, and that everything is a MATLAB variable with already provided numerical value. How would you calculate the numerical value of your objective function? Once you figure that out,it should be easy to convert that into CVX code. Although it's usually a good idea to vectorize your code where possible, CVX allows you to use for loops to build up expressions.
is it correct to do like that? variable p(5,1) for i=1:5 obj=obj+p(i)*p(i) end minimize (obj)
That is valid provided that you have the statement obj = 0 before the for loop.
obj = 0
However, this can be written in a vectorized way as follows: