Tfmin: Difference between revisions
From TomWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Solvers]] | |||
{{cleanup|Clean this article.}} | |||
==Purpose== | ==Purpose== | ||
Revision as of 08:23, 11 July 2011
{{#switch: | left =
{{#switch:{{#if: | {{{smallimage}}} | }} | none =| #default =
}} {{#if:{{#if: | {{{smallimageright}}} | }} | {{#ifeq:{{#if: | {{{smallimageright}}} | }}|none | | }} }}{{
#switch:left | left =| #default = }} {{#if:{{#if: | {{{smallimage}}} | }} | {{#if: | {{{smallimage}}} | }} | [[File:{{#switch:caution | critical = Ambox speedy deletion.png | important = Ambox deletion.png | warning = Ambox content.png | caution = Cleanup.png | move = Ambox move.png | protection = Ambox protection.png | notice | #default = Cleanup.png }} | {{#switch:left | left = 20x20px | #default = 40x40px }} |link=|alt=]] }}{{#switch:left | left =| #default = | {{#if:
| {{{smalltext}}} | Cleanup is needed}} | {{#switch:left
| left = {{#if: | {{{smallimageright}}} | }}| #default = {{#if:
}}| {{{smallimageright}}} |}} |
| #default =
{{#switch: | none =| #default =
}}{{#if: | {{#ifeq:|none
|| }} }}
{{
#switch: | left =| #default = }} {{#if: | | [[File:{{#switch:caution | critical = Ambox speedy deletion.png | important = Ambox deletion.png | warning = Ambox content.png | caution = Cleanup.png | move = Ambox move.png | protection = Ambox protection.png | notice | #default = Cleanup.png }} | {{#switch: | left = 20x20px | #default = 40x40px }} |link=|alt=]] }}{{#switch: | left =| #default = | Cleanup is needed Clean this article. |
{{#switch:
| left =| #default = |
}}
Purpose
Minimize function of one variable. Find miniumum x in [x_L, x_U] for function Func within tolerance xTol. Solves using Brents minimization algorithm. Reference: "Computer Methods for Mathematical Computations", Forsythe, Malcolm, and Moler, Prentice-Hall, 1976.
Calling Syntax
[x, nFunc] = Tfmin(Func, x_L, x_U, xTol, Prob)
Description of Inputs
Variable | Description |
Func | Function of x to be minimized. Func must be defined as: |
f = Func(x) if no 5th argument Prob is given or | |
f = Func(x, Prob) if 5th argument Prob is given. | |
x_L | Lower bound on x. |
x_U | Upper bound on x. |
xTol | Tolerance on accuracy of minimum. |
Prob | Structure (or any Matlab variable) sent to Func. If many parameters are to be sent to Func set them in Prob as a structure. Example for parameters a and b: |
Prob.user.a = a; Prob.user.b = b; | |
[x, nFunc] = Tfmin('myFunc',0,1,1E-5,Prob); In myFunc: | |
function f = myFunc(x, Prob) | |
a = Prob.user.a; | |
b = Prob.user.b; | |
f = "matlab expression dependent of x, a and b"; |
Description of Outputs
Variable | Description |
x | Solution. |
nFunc | Number of calls to Func. |