The usual way to deal with a nonlinear curve from a sensor or whatever is to linearize it. One method for doing that is by "curve fitting", where you find an analytic equation that reproduces the curve you are interested in. A nice tool for this can be found at: http://www.ebicom.net/~dhyams/cvxpt.htm The other common method is to have a table in your program. Your software finds the nearest matching value in the table. If that's close enough for your application, then you're done. If it's not, then you interpolate between the nearby table entries using methods that are well described in any numerical methods textbook. Once you have a nice linear number (0% - 100% for instance), then messing around with it becomes pretty simple and non-confusing. > -----Original Message----- > From: Drew Vassallo [mailto:snurple@HOTMAIL.COM] > Sent: Sunday, July 01, 2001 8:54 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Scaling of a curve > > > Math geniuses of PICLIST: > > I have a series of 40 points that represent a curve. It's > not a linear > curve. In fact, it doesn't necessarily even have a positive slope > throughout. What I want to do is to create a scaling that is variable > depending on the position on the curve. It's probably best to give an > example: > > point 40 = 100 (dec.) > point 30 = 80 > point 20 = 75 > point 10 = 70 > point 1 = 35 > > Let's say at point 30, we want to add an additional 10% to > the value. So, I > want to add an additional 10% also at all the other points (3 > or 4 at point > 1 and 10 at point 40). This will, of course, change the > characteristics of > the curve as a whole, but it is necessary in this application. > > Any quick ways? My initial idea was to take the percentage and try to > multiply it out, but I'm not sure how this would work over the entire > percentage range (i.e., I could be adding as little as 1% or > as much as > 200%) and I would probably need some sort of floating point > math for any > sort of precision at the lower values. > > My other idea was just to take the endpoints, find the ratio > between them, > and linearly scale the intermediate points, even though > that's not entirely > accurate, but it's better than nothing. > > Thanks, > --Andrew > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics