Hi,
I am using cvx to solve a least square problem. The objective function is:
minimise( norm(y - phi_u1*g1 - phi_u2*g2, 2) + gamma1*norm(g1,2) + gamma2*norm(g2,2) );
which is close to the standard L2-regularised least square problem. The size of y,u1,u2 are 2001x1, the size of phi_u1 and phi_u2 are 2001x400.
The problem is that the cvx does not produce any output for an hour. I guess cvx gets stuck at formulating the problem. Anyway to solve the problem? I know there is an analytical solution for this problem, but I plan to add LMI constraints to this objective function later, but cvx even can’t solve it without any constraints.
Any suggestion will be deeply appreciated!
Here is the full code
Out_ = TwoFIR_cvx(u1_cvx,u2_cvx,y_cvx,para);
function Out_ = TwoFIR_cvx(u1,u2,y,para)
%y = FIR(u1) + FIR(u2)
if ~iscolumn(u1)
error('need vec format input u1');
end
if ~iscolumn(u2)
error('need vec format input u2');
end
if ~iscolumn(y)
error('need vec format output y');
end
N = para.N;
M1 = para.M1;
M2 = para.M2;
cvx_begin sdp
variables g1(M1,1) g2(M2,1);
expressions phi_u1(N,M1) phi_u2(N,M2); %can't declare here! otw bug!
for i = 1:N
for j = 1:M1
if j>i
phi_u1(i,j) = 0.0;
else
phi_u1(i,j) = u1(i-j+1);
end
end
end
for i = 1:N
for j = 1:M2
if j>i
phi_u2(i,j) = 0.0;
else
phi_u2(i,j) = u2(i-j+1);
end
end
end
minimise( norm(y - phi_u1*g1 - phi_u2*g2, 2) + para.gamma1*norm(g1,2) + para.gamma2*norm(g2,2) ); %minimise 2-norm
cvx_end
Out_.g1 = g1;
Out_.G1 = filt(g1',1,para.Ts);
Out_.phi_u1 = full(phi_u1);
Out_.g2 = g2;
Out_.G2 = filt(g2',1,para.Ts);
Out_.phi_u2 = full(phi_u2);
Out_.para = para;
end