EETimes

Embedded Systems December 2000 Vol13_13

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

Contents of this Issue

Navigation

Page 37 of 197

PROGRAMMER'S TOOLBOX • Should we require at least five points, so that we can be assured of having the number I now think we need to get a good halting criterion? We could do that, but it's · always possible that the minimum was back at the second point. T he success of thi approach depends upon choosing wisely the in terval, which is de termined by n. If f( x) has a minimum th a t occurs between two mesh poin ts th at are oth- erwise monotonic, we would nevel- see tha t. On the o the r hand, we do n 't wan t to waste a lot of time stepping in smal l steps if coarse ones will do. The implication he re is th a t o ne should understand the nature of the function one is trying to minimize. A gmph is always a good idea. You just can 't use these routines blindly, trusting them to replace common sense. o te again tha t we must have at least three po in ts , so n must be a t least 2. Should we req uire at least five poin ts, so that we can be assu red of hav- ing the number 1 now think we need to get a good halting cri terion? We could do that, but it's always possible that the minimum was back at the second point. To avoid su ch problems, I pre fe r to eithe r execute those two golden section steps (the best a rgument for doing so), or keep t.-ack of the numbe r of poin ts currently available. Matters of state Witll the aid of tlle d river minimizeO, we can build a truly general-purpose minimizer. But we still n eed . to fl esh You a ways believed there were more int Hi ent embedded tools out there. People doubted their existence - yet you continued to search - and now you've found them. COSMIC C compilers are fa st, efficient, reliable, and produce the tightest object code available. Cosmic Software's embedd ed developmenttools offer portability for a complete line of micro- controllers. All toolkits include IDEA, our intuitive IDE that provides everything you need in a single, seamless Windows framework. You wer right. G SMIC Software E-mail: c-tools@cosmic-us.com www.cosmic-software.com Phone: US ..... . .. 781 932-2556 France ... . . 331 4399 5390 UK . . .. .... 4401256 843400 Germany ... 490711 4204062 Sweden . .. . 46 31704 3920 Add ZAp, our non-intrusive source- level debuggers and minimize your test cycle too. Want proof of their existence? Download a free evaluation copy of our development tools at www.cosmic-software.com or call Cosmic today. Cosmic supports the Motorola family of microcontrollers: 68HC05, 68HC08, 68HC11. 68HC12, 68HC16, 68300 and STMicroelectronics' ST7 Family. out tlle three-poin t function , find- minO, tlla t it calls. Tha t will be the thrust of next mo nth 's column. For now, I'll leave you with a ske leton ve r- sio n of the code, which shows the structure impleme nting th e sta te mach ine . Tha t cod e is shown as Listing 3. I've a lso made o ne o th e r basic change. Last time I forced eve ry bisec- tion step to bisect both left and righ t inte rva ls. This wa done to urge Xo and Xi! inwa rds, toward tlle true minimum. Howeve r, it caused the bisections to bu rn mo re fu n ct io n evalua tio ns, which makes the a lgoritllm look bad re lative to Bre nt's me thod . So he re ['ve reve rted to do ing only a single bisection, but 1 keep track of which interval, left or righ t, I bisected last. I do force two bisections at tlle start, so that 1 know I have a t least five da ta points befo re the first quadra tic fit. T he d irection , past va lues, and so on are ma in ta ined , along with tlle ta te machine state, in variables tha t a re glo bal to the fi le (but wo uld be pmp- ed y invisible to other fi les). We ' )) con tin ue this process next esp month. See you then. Jadl W Crenshaw is a senior principal design engineer at A Want Tech Systems in ClectTwater, FL. He did much eaTty wOTk in the space jJrogmm and has devel- oped nmnprous analysis and Teal-time jJrograms. He is the author of Ma th Toolkit fo r Real-Time Programming from CMP Books. He holds a PhD in jJhysics from A ubuTn UniveTsity. CTenshnw enj oys contact and can be -reached via j crens@earthlink. net. References 1. Crenshaw, Jack. Math Toolkit for Real- Time Programming. Lawrence, KS: CMP Books, 2000. 2. Brent, R.P. Algorithms for Minimization Without Derivatives. Englewood Cliffs, NJ: Prentice-Hall, 1973. 3. Press, William H., et al. Numencal Recipes 117 C. Cambridge: Cambridge University Press, 1992. 36 DECEMBER 2000 Embedded Systems Programming e-mail at

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems December 2000 Vol13_13