How to predefine elements of a matrix (variable) in CVX?


I want to perform linear regression, but some elements of the regressor variable are already known. How do I tell cvx that it must solve for the other variables and predefine the known elements?

Y = A*X

where Y is (for instance) a 3x10 matrix, A is 3x3 and X is 3x10.

I want to minimise the 2 norm of A*X-Y.

cvx_begin quiet
    variables A(3,3) 
    minimize( norm(A*X-Y,2) )

I want to solve this problem , but I already know some elements of A.

Any suggestions on how to program this into cvx?

Thank you in advance!

Use equality constraints like A(1,2)==3;.

Another option is to build up the matrix using concatenation to form A as an expression.

variable x(5)
A = [1 2 x(1);x(2) 4 x(3);x(4) -2 x(5)];

Yes that would work! But what if my variables are changing between replications (e.g. A(1,1)=x(1))? Or what if my A matrix is large? Is there a way to automate this?

If you provide the specifics of a problem of interest, perhaps a poster can provide more specific advice.

I figured out a way to do this. Thanks anyways!