ExpSolve
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:
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{array}{|r|rrrrrrrrr|} t_i & 0 & 1.00 & 2.00 & 4.00 & 6.00 & 8.00 & 10.00 & 15.00 & 20.00\\y_i & 905.10 & 620.36 & 270.17 & 154.68 & 106.74 & 80.92 & 69.98 & 62.50 & 56.29\\ \end{array} }
To set up and solve the problem of fitting the data to a two-term exponential model
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f(t) = \alpha_1 e^{-\beta_1 t} + \alpha_2 e^{-\beta_2 t}}
,
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 Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x} vector contains the parameters as Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x=[\beta_1,\beta_2,\alpha_1,\alpha_2]} 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>
