ExpSolve: Difference between revisions
From TomWiki
Jump to navigationJump to search
Line 25: | Line 25: | ||
{| class="wikitable" | {| class="wikitable" | ||
!Result||TOMLAB Result structure as returned by solver selected by input argument ''Solver''. | !''Result''||TOMLAB Result structure as returned by solver selected by input argument ''Solver''. | ||
|- | |- | ||
|''LS''||Statistical information about the solution. See [[TOMLAB Appendix B]]. | |''LS''||Statistical information about the solution. See [[TOMLAB Appendix B]]. |
Revision as of 10:05, 20 July 2011
Purpose
Solve exponential fitting problems for given number of terms p.
Calling Syntax
Prob = expAssign( ... );
Result = expSolve(Prob, PriLev); or
Result = tomRun('expSolve', PriLev);
Inputs
Prob | Problem created with expAssign. |
---|---|
PriLev | Print level in tomRun call. |
Prob.SolverL2 | Name of solver to use. If empty, TOMLAB selects dependent on license. |
Outputs
Result | TOMLAB Result structure as returned by solver selected by input argument Solver. |
---|---|
LS | Statistical information about the solution. See TOMLAB Appendix B. |
Description
expSolve solves a cls (constrained least squares) problem for exponential fitting formulates by expAssign. The problem is solved with a suitable or given cls solver.
The aim is to provide a quicker interface to exponential fitting, automating the process of setting up the problem structure and getting statistical data.
M-files Used
GetSolver, expInit, StatLS and expAssign
Examples
Assume that the Matlab vectors t, y contain the following data:
To set up and solve the problem of fitting the data to a two-term exponential model
,
give the following commands:
>> 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); >> Result = tomRun('expSolve',Prob,1); >> x = Result.x_k' x = 0.01 0.58 72.38 851.68
The vector contains the parameters as so the solution may be visualized with
>> plot(t,y,'-*', t,x(3)*exp(-t*x(1)) + x(4)*exp(-t*x(2)) );
<figure id="fig:expData">
</figure>