Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Help with lsqlin

Subject: Help with lsqlin

From: John Smith

Date: 28 Jul, 2011 17:02:29

Message: 1 of 2

I am trying to use lsqlin to solve three equations with more than three unknowns. I am calling lsqlin in a loop. Here are some results:

Warning: Large-scale algorithm requires at least as many equations as variables
    in C matrix; using medium-scale algorithm instead.
> In lsqlin at 282
  In least_squares at 611
Maximum number of iterations exceeded; increase options.MaxIter.
To continue solving the problem with the current solution as the
starting point, set x0 = x before calling lsqlin.

soltn =

  940.0000
         0
  940.0000
  134.2857
  336.8863


Warning: Large-scale algorithm requires at least as many equations as variables
    in C matrix; using medium-scale algorithm instead.
> In lsqlin at 282
  In least_squares at 611
Optimization terminated.

soltn =

  940.0000
  940.0000
         0
         0
  471.1721




I think I understand the first result-- it has not found a solution, but is displaying how far it got. Can anyone explain what the second result means? Why was it terminated? Is the answer a solution?

Thanks for the help.

Subject: Help with lsqlin

From: Alan Weiss

Date: 28 Jul, 2011 19:37:42

Message: 2 of 2

On 7/28/2011 1:02 PM, John Smith wrote:
> I am trying to use lsqlin to solve three equations with more than three
> unknowns. I am calling lsqlin in a loop. Here are some results:
>
> Warning: Large-scale algorithm requires at least as many equations as
> variables
> in C matrix; using medium-scale algorithm instead.
>> In lsqlin at 282
> In least_squares at 611
> Maximum number of iterations exceeded; increase options.MaxIter.
> To continue solving the problem with the current solution as the
> starting point, set x0 = x before calling lsqlin.
>
> soltn =
>
> 940.0000
> 0
> 940.0000
> 134.2857
> 336.8863
>
>
> Warning: Large-scale algorithm requires at least as many equations as
> variables
> in C matrix; using medium-scale algorithm instead.
>> In lsqlin at 282
> In least_squares at 611
> Optimization terminated.
>
> soltn =
>
> 940.0000
> 940.0000
> 0
> 0
> 471.1721
>
>
>
>
> I think I understand the first result-- it has not found a solution, but
> is displaying how far it got. Can anyone explain what the second result
> means? Why was it terminated? Is the answer a solution?
>
> Thanks for the help.

Sorry for the confusing exit message. "terminated" simply means stopped,
it doesn't necessarily mean anything bad happened.

You can check the quality of the solution by examining the exit flag, or
by substituting the answer into the problem.

To see how to obtain an exit flag, or to avoid the warning by setting
the LargeScale option to 'off', consult the function reference page:
http://www.mathworks.com/help/toolbox/optim/ug/lsqlin.html

Alan Weiss
MATLAB mathematical toolbox documentation

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us