## Friday, February 03, 2006

### Study: Curve Fitting in Matlab

Matlab has a curve fitting toolbox that can make most of curve fitting tasks handy. If we know a formal form of a target function and perhaps can arrange it properly, curve fitting process should converge fast enough.

However, one of the major problems even when we know the formal form is that we can't arrange our term properly. In such a situation, many people try to use the generalized curve fitting capability in Matlab instead. However, it converges slower than it should be. For example, if we are going to fit hyperbolic function: y = a/(x-b), if we do not notice that this is actually a simplified version of rational form (http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/ch_fit10.html), we may resort to use general equation (http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/ch_fitt7.html#69221) . Although it is easier, it tends to converges slowly.

In case that we do not have the curve fitting toolbox, we may use an optimization toolbox instead. In fact, general equations defined in the curve fitting toolbox relies on the optimization toolbox. However, using the optimization toolbox requires more complicated management of data array.

Document on the optimization toolbox can be found at
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/optim.html?BB=1.

And the most relevant page in the document is at
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/f3204.html#f1974

In summary, if we have a curve fitting toolbox, our curve fitting tasks will be very easy. But only optimization toolbox is sufficient. Please note that the curve fitting toolbox do not work independently; you need to have statistics and optimization toolboxes as well.

FYI:
http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/