Quickguide NLLS Problem: Difference between revisions

From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the Quickguide Manual|link=Quickguide}} The '''constrained nonlinear least squares''' ('''cls''') problem is defined as <math> \begin{arr...")
 
No edit summary
 
Line 16: Line 16:




where <math>x, x_L, x_U \in \MATHSET{R}^n</math>, <math>r(x) \in \MATHSET{R}^M</math>,
where <math>x, x_L, x_U \in \mathbb{R}^n</math>, <math>r(x) \in \mathbb{R}^M</math>,
<math>A \in \MATHSET{R}^{m_1 \times n}</math>, <math>b_L,b_U \in
<math>A \in \mathbb{R}^{m_1 \times n}</math>, <math>b_L,b_U \in
\MATHSET{R}^{m_1}</math> and <math>c_L,c(x),c_U \in \MATHSET{R}^{m_2}</math>. The
\mathbb{R}^{m_1}</math> and <math>c_L,c(x),c_U \in \mathbb{R}^{m_2}</math>. The
following file defines and solves a problem in TOMLAB.
following file defines and solves a problem in TOMLAB.


Line 36: Line 36:
Open the file for viewing, and execute nllsQG in Matlab.
Open the file for viewing, and execute nllsQG in Matlab.


<syntaxhighlight lang="matlab">
<source lang="matlab">
  % nllsQG is a small example problem for defining and solving
  % nllsQG is a small example problem for defining and solving
  % nonlinear least squares using the TOMLAB format.
  % nonlinear least squares using the TOMLAB format.
Line 68: Line 68:
  %Result = tomRun('minos', Prob, 1);
  %Result = tomRun('minos', Prob, 1);
  %Result = tomRun('oqnlp', Prob, 1);
  %Result = tomRun('oqnlp', Prob, 1);
</syntaxhighlight>
</source>

Latest revision as of 07:51, 17 January 2012

Notice.png

This page is part of the Quickguide Manual. See Quickguide.

The constrained nonlinear least squares (cls) problem is defined as



where , , , and . The following file defines and solves a problem in TOMLAB.

The following files define a problem in TOMLAB.

File: tomlab/quickguide/nllsQG_r.m, nllsQG_J.m

r: Residual vector
J: Jacobian matrix

The following file illustrates how to solve an NLLS problem in TOMLAB. Also view the m-files specified above for more information.

File: tomlab/quickguide/nllsQG.m

Open the file for viewing, and execute nllsQG in Matlab.

 % nllsQG is a small example problem for defining and solving
 % nonlinear least squares using the TOMLAB format.
 Name='Gisela';
 
 t = [0.25; 0.5; 0.75; 1; 1.5; 2; 3; 4; 6; 8; 12; 24; 32; 48; 54; 72; 80;...
      96; 121; 144; 168; 192; 216; 246; 276; 324; 348; 386];
 y = [30.5; 44; 43; 41.5; 38.6; 38.6; 39; 41; 37; 37; 24; 32; 29; 23; 21;...
      19; 17; 14; 9.5; 8.5; 7; 6; 6; 4.5; 3.6; 3; 2.2; 1.6];
    
 x_0 = [6.8729, 0.0108, 0.1248]';
 
 % See help clsAssign for more information.
 Prob = clsAssign('nllsQG_r', 'nllsQG_J', [], [], [], Name, x_0, ...
                  y, t);
 
 % Parameter which is passed to r and J routines.             
 Prob.uP = 5;
 
 Result = tomRun('clsSolve', Prob, 1);
 %Result = tomRun('nlssol', Prob, 1);
 
 % Any nonlinear solver can be used. TOMLAB automatically
 % uses gateway routines for problem mapping.
 
 %Result = tomRun('filterSQP', Prob, 1);
 %Result = tomRun('knitro', Prob, 1);
 %Result = tomRun('conopt', Prob, 1);
 %Result = tomRun('snopt', Prob, 1);
 %Result = tomRun('npsol', Prob, 1);
 %Result = tomRun('minos', Prob, 1);
 %Result = tomRun('oqnlp', Prob, 1);