# TOMLAB  
# REGISTER (TOMLAB)
# LOGIN  
# myTOMLAB
TOMLAB LOGO

« Previous « Start » Next »

13  NLLS Problem

The constrained nonlinear least squares (cls) problem is defined as
 
min
x
f(x) =
1
2
r(x)T r(x)
   
s/t
xL x xU,
bL A x bU
cL c(x) cU
    (15)
where x, xL, xU ∈ Rn, r(x) ∈ RM, A ∈ Rm1 × n, bL,bU ∈ Rm1 and cL,c(x),cU ∈ Rm2. 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);

« Previous « Start » Next »