At 09:54 AM 7/1/01 -0400, Drew wrote: >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. Questions: 1. What resolution do you need for the multiplicative scaling from 1% to 200%? E.g., 1:256, 1:4096, etc. 2. What accuracy, if any, do you need for cumulative displacement from the original scale? 3. What accuracy is required for the invariance of the ratio of points in the original scale? E.g., 1:256, 1:4096, 1:65536, etc. 4. What is the maximum number of times rescaling will occur? >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. The simplest solution would be to add the original values to a fixed point multiple by an 8-bit coefficient. This, however, would result in cumulative scaling errors growing as multiple scalings occur. The long-term relative drift can be controlled by either adding bits of accuracy (e.g., 16, 24 or 32 bit values with corresponding fixed point arithmetic), or by a simpler method of scaling only the maximum number and then rescaling the other numbers to the maximum, based on stored values of the original scale: New Value = Scaled Max Value x Orig Value / Orig Max Number The error in this case is just the single scaling error plus the single rounding error. >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. This is basically the idea, but say "original scale" instead of "original scale". ================================================================ Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: ral@lcfltd.com Least Cost Formulations, Ltd. URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239 Fax: 757-467-2947 "Vere scire est per causas scire" ================================================================ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads