Sat Dec 13, 2014 9:01 pm by f14-jbhoward

Emily-

That is the correct way to solve the formula. You must have incorrectly sized LHS and RHS of the lagrange multiplier formula, try something like this:

Initializing and solving LHS Matrix:

[rows_phiq,col_phiq]=size(Phiq_out);

c_max=col_m+rows_phiq;

r_max=rows_m+rows_phiq;

LHS=zeros(r_max,c_max);

Z=zeros(rows_phiq);

LHS(1:rows_m, 1:col_m)=M;

LHS(rows_m+1:r_max, 1:col_phiq)=Phiq_out;

LHS(rows_m+1:r_max,col_m+1:c_max)=Z;

LHS(1:col_phiq, col_m+1:c_max)=transpose(Phiq_out);

Initializing and solving RHS Matrix:

[size_g,~]=size(Gamma_out);

RHS=zeros(size_g+(columns_b*3),1);

Q=getQ(~,~,~,~,~);

[size_Q,~]=size(Q);

RHS(1:size_Q,1)=Q;

RHS(size_Q+1:size_Q+size_g,1)=Gamma_out;

Hope that help you out!

-James