From PICLIST@MITVMA.MIT.EDU Fri Nov 15 16:09:03 2002 Received: from cherry.ease.lsoft.com [209.119.0.109] by dpmail10.doteasy.com with ESMTP (SMTPD32-7.13) id AC9F1076006C; Fri, 15 Nov 2002 16:09:03 -0800 Received: from PEAR.EASE.LSOFT.COM (209.119.0.19) by cherry.ease.lsoft.com (LSMTP for Digital Unix v1.1b) with SMTP id <5.007DE0CB@cherry.ease.lsoft.com>; Fri, 15 Nov 2002 18:54:53 -0500 Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (LISTSERV-TCP/IP release 1.8d) with spool id 1166 for PICLIST@MITVMA.MIT.EDU; Fri, 15 Nov 2002 18:54:42 -0500 Received: from MITVMA (NJE origin SMTP@MITVMA) by MITVMA.MIT.EDU (LMail V1.2d/1.8d) with BSMTP id 4485; Fri, 15 Nov 2002 18:52:41 -0500 Received: from *unknown [209.66.107.17] by mitvma.mit.edu (IBM VM SMTP Level 320) via TCP with SMTP ; Fri, 15 Nov 2002 18:52:40 EST X-Warning: mitvma.mit.edu: Host *unknown claimed to be brouhaha.com Received: (qmail 5009 invoked by uid 1032); 15 Nov 2002 23:52:40 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 15 Nov 2002 23:52:40 -0000 X-X-Sender: sdattalo@ruckus.brouhaha.com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Message-ID: Date: Fri, 15 Nov 2002 15:52:40 -0800 Reply-To: pic microcontroller discussion list Sender: pic microcontroller discussion list From: Scott Dattalo Subject: Re: [EE]:Pressure sensor confusion To: PICLIST@MITVMA.MIT.EDU In-Reply-To: <3dd58233.5953346@smtp.comcast.net> X-RCPT-TO: Status: R X-UIDL: 277600752 X-Evolution-Source: pop://mailinglist%40farcite.net@mail.farcite.net/ X-Evolution: 000007b4-0000 On Fri, 15 Nov 2002, Dave Dilatush wrote: > Lawrence Lile wrote... > > >That's one way to deal with it. > > > >A typical problem for me is interpolating thermistor data. The thermistor > >curve comes in chart form from the manufacturer, in very un-handy > >increments. It's quite a complex curve, and I think curve fitting it > >would be a long involved task (unless Excel does this automatically > >somehow? ) Linear curve fitting would be a cinch. The only way I know > >how to curve fit a nonlinear is, guess at the type of equation to use, > >plot it next to your data, sum the squares of the differences, then run a > >linear regression on the results and use a Tools:GoalSeek on the results > >to approach the minimum, then guess again at the type of equation to use > >until you like the fit.. It is a time-consuming process, usually. > > > >Is there a more efficient way? > > Least-squares curve fitting will give you a set of coefficients > for an interpolation polynomial and is especially useful where > you can take a lot of data points, but the data are noisy. > > Another technique for generating interpolating polynomial > coefficients is Newton's Method of Divided Differences. This > method will take (N) data points and give you the coefficients > for a (N-1)th-order polynomial that passes precisely through the > points. The computations for this technique are easy, and it > works very well when you have a limited amount of data but the > data are largely noise-free. > > One writeup of Newton's Method that looks like a good summary of > the technique is at: > > http://classes.cecs.ucf.edu/egn3420/klee/Notes/Interpolation/Interp_NDD.pdf > > but you can probably get more from Google. If the curve is to be placed in a PIC, then I'd suggest a look up table with linear interpolation. I've used it for thermistors before and it works just fine. You can easily get 7-bits of dynamic range with 16-sample 8-bits/sample table. Check out http://www.dattalo.com/technical/software/pic/picsine.html For an example of an efficient way of interpolating between successive entries in a look up table. If you more dynamic range, then the idea is easily extended (either add more samples or increases the bits/sample). Scott -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.