MATLAB: How do you constrain values in x using lsqlin

constraintslinear systemslsqlinlsqrmatricessystem of equations

I'd like to add constraints to the first 7 values of my x vector from the solution of Ax=b using lsqlin. Specifically, that those first 7 values sum to zero. It's not clear to me how to do that using the Aeq/beq, or lb/ub inputs the tool accepts. Can anyone advise?

Best Answer

Aeq=zeros(size(x));
Aeq(1:7)=1;
beq=0;