MATLAB: Lsqlin: C is M-by-N. Is M=N possible

lsqlin

Hello everybody,
the MathWorks Documentation for lsqlin says that the input argument C is a M-by-N, where M is the number of equations, and N is the number of elements of x. I use lsqlin with bounds (lb,ub) and linear constraints (A,b). Is it possible to use lsqlin for M=N?
Thank you!
Diana

Best Answer

Why not test it yourself? The simplest way to answer a question like this (and the FASTEST way) is a simple test when you are not sure.
lsqlin(rand(10,10),rand(10,1),rand(3,10),rand(3,1),[],[],zeros(10,1),ones(10,1))
Warning: The trust-region-reflective algorithm can handle bound constraints only;
using active-set algorithm instead.
> In lsqlin (line 300)
Optimization terminated.
ans =
0.32162
0
0
0
0
0
0
0.16786
0
0.2514
The answer is yes, of course. No statement in the help is made that M MUST be greater than N. It is probably true that most of the time, one would have M>N to use lsqlin.