# EETimes

## Embedded Systems December 2000 Vol13_13

Issue link: http://dc.ee.ubm-us.com/i/71850

## Contents of this Issue  ## Navigation

### Page 23 of 197

PROGRAMMER'S TOOLBOX It's been a while since we specifically discussed the math of parabolic fits. What's more, it can be quite tricky, and you will get slightly different results depending on the form you assume for f(x). 1110 = Y I - Yo X I -Xu /11 1 = Y2 - Y I X2 - XI algorithm and u"ied to break it. Sigh. I gue s I'm going it alone he re, so I might as well get on with it. Some parabolic math It's been a whi le since we specifically discussed the math of parabolic fi ts. What's more, it can be quite tricky, and you wi ll get slightly diffe re nt resul ts depending on the form you assume fOI " fix) . To make matters worse, I've used different forms in past articles, so I think it's best if we sum- marize the process of fittin g a parabo- la to three data points here. We start by assuming that we have three data poin ts: Po = [Xo, )'0] PI = [XI' YI] P2 = [~, )'2] Next, we a sume a quadratic equation using Newton's form: (2) Note carefully the choice of X indices used. This is very important. Next, we force the function to fit at these three poin ts. This allows us to solve for the three coefficients a, b, and c. The equations are: b = Y2 - Yo = 111 X2 -Xo (4) Note that this parameter has the form of the slope, 171, of a straight line. In th is case, tile line connects points Po and P2, the two end poin ts of the range. We are now left to solve the second equation for c. We have: Y I - Yo ---= m +cxl- x 2 X I -Xo ( ) (5) Again , the left side has the form of a slope, this time of the line between Po and PI ' We can properly defin e this as )110. Then we get: C = /11- 1110 X2 - X I (6) It is not at all obvious from tile form, but this is the same thing as the "slope of slopes": C = ml - 1110 X2 - Xo (7) whe re /1l1 is a slope just like mo, but from PI to P2. The easiest way to prove th e equiva lence is to expand Simpli fYing gives: both expressions out and compare terms. Using the slopes gives us an easy way to compute b and c. Defin e: 22 DECEMBER 2000 Embedded Systems Programming Simplifying give: (11) It's worth noting that c cannot be zero, since it's the difference of two slopes that are necessarily non-ze ro and of opposite signs. That condition is a neces a ry co nsequence of Equation 1. The slope m, on th e othe r hand, can be zero, and wi ll be if Yo = )'2' Thi is the case when we start out with a balanced geome try. In this case, xmin is simply the average of Xo and ~, and is independent of the val- ues of Y = f( x) . Substituting the value for x",in into our function gives the predicted mini- m um val ue of f( x). It is: or: Xmin ="2 l( X2 +xo --;;- 111 ) (10) Yo = a (3) III = Y2 - Yo X2 -Xo Then b = 111, and c is the slope of slopes given in Equation 7. OUf functional form can then be wTitten: The first equation clearly gives the value of G, us b: (8) directl y. The third one gives Recall tllat at the minimum the slope of thi s fun cti on must be zero. Differentiating Equation 9 gives:

## Archives of this issue

view archives of EETimes - Embedded Systems December 2000 Vol13_13