lsqlin Failure! Why is the simple example provided by MATLAB failing to execute?
3 views (last 30 days)
Show older comments
I recently discovered the MATLAB optimization routine lsqlin. I attempted to run a simple 'MATLAB-approved' example to get a feel for the function: http://www.mathworks.com/help/toolbox/optim/ug/lsqlin.html. The example is written slightly beyond the middle of the page. I executed a simple copy/paste of the code, but received the following error message:
>> [x,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[ ],[ ],lb,ub);
Warning: Large-scale algorithm can handle bound constraints only; using medium-scale algorithm instead.
> In lsqlin at 286
Optimization terminated.
I tried executing the function again, but this time without referencing the final four parameters:
>> x = lsqlin(C,d,A,b);
Warning: Large-scale algorithm can handle bound constraints only; using medium-scale algorithm instead. > In lsqlin at 286 Optimization terminated.
I am running MATLAB 2009b and have verified that the Optimization Toolbox is installed. Any help is appreciated.
0 Comments
Accepted Answer
Andrew Newell
on 26 Jan 2011
I tried the example and it gave the warning but the outputs x, etc., were the same as in the example. "Optimization terminated" sounds ominous, but it just means that it finished successfully.
If you want to run this same example without the warning, try this:
>> options = optimset('lsqlin');
>> options = optimset(options,'LargeScale','off');
>> [x,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[ ],[ ],lb,ub,[],options);
More Answers (0)
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!