Quickguide EXP Problem: Difference between revisions
From TomWiki
Jump to navigationJump to search
(Created page with "{{Part Of Manual|title=the Quickguide Manual|link=Quickguide}} Exponential fitting problems are a set of special problems normally solved by ''expSolve''. Several ...") |
No edit summary |
||
Line 2: | Line 2: | ||
Exponential fitting problems are a set of special problems normally solved by ''expSolve''. Several different models are treated in <span class="roman">TOMLAB</span>: | Exponential fitting problems are a set of special problems normally solved by ''expSolve''. Several different models are treated in <span class="roman">TOMLAB</span>: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+<caption>Exponential models treated in TOMLAB.</caption> | |+<caption>Exponential models treated in TOMLAB.</caption> | ||
Line 17: | Line 16: | ||
|<math>f(t) = \sum\limits_i^p t \alpha_i e^{-\beta_i (t - \gamma_i)}</math>||<math>\alpha_i \geq 0</math>||<math>0\leq\beta_1<\beta_2< ... <\beta_p</math>. | |<math>f(t) = \sum\limits_i^p t \alpha_i e^{-\beta_i (t - \gamma_i)}</math>||<math>\alpha_i \geq 0</math>||<math>0\leq\beta_1<\beta_2< ... <\beta_p</math>. | ||
|} | |} | ||
Example problem: | Example problem: | ||
Line 39: | Line 37: | ||
Open the file for viewing, and execute expQG in Matlab. | Open the file for viewing, and execute expQG in Matlab. | ||
< | <source lang="matlab"> | ||
% expQG is a small example problem for defining and solving exponential | % expQG is a small example problem for defining and solving exponential | ||
% fitting problems using the TOMLAB format. See the TOMLAB manual for | % fitting problems using the TOMLAB format. See the TOMLAB manual for | ||
Line 58: | Line 56: | ||
%Prob.SolverL2 = 'snopt'; | %Prob.SolverL2 = 'snopt'; | ||
%Result = tomRun('expSolve',Prob,1); | %Result = tomRun('expSolve',Prob,1); | ||
</ | </source> |
Latest revision as of 18:32, 17 January 2012
This page is part of the Quickguide Manual. See Quickguide. |
Exponential fitting problems are a set of special problems normally solved by expSolve. Several different models are treated in TOMLAB:
. | ||
. | ||
. | ||
. | ||
. |
Example problem:
The vectors t, y contain the following data:
Setup and solve the problem of fitting the data to a two-term exponential model:
The following file defines and solves the problem in TOMLAB.
File: tomlab/quickguide/expQG.m
Open the file for viewing, and execute expQG in Matlab.
% expQG is a small example problem for defining and solving exponential
% fitting problems using the TOMLAB format. See the TOMLAB manual for
% options.
% f(t) = alpha(1)*exp(-beta(1)*t) + alpha(2)*exp(beta(2)*t)
t = [0 1.00 2.00 4.00 6.00 8.00 10.00 15.00 20.00]';
y = [905.10 620.36 270.17 154.68 106.74 80.92 69.98 62.50 56.29]';
p = 2; % Two terms
Name = 'Simple two-term exp fit'; % Problem name, can be anything
wType = 0; % No weighting
SepAlg = 0; % Separable problem
Prob = expAssign(p,Name,t,y,wType,[],SepAlg);
Prob.SolverL2 = 'nlssol';
Result = tomRun('expSolve',Prob,1);
%Prob.SolverL2 = 'snopt';
%Result = tomRun('expSolve',Prob,1);