Hi all, I'm working with a function that only accepts values between 0 and 1, so I need to scale my data first.

The first part involved in this is calculating the high/low values of my inputs. I pass this into a function that churns out X and Y values for the intersectionX => aX + b between the line X => highX + low and X => 0X + 1

I then iterate through every input value, applying the following formula:
$data = (($x_y['x'] * $rawData) + $x_y['y']);

Now, my problem is that the function I pass the scaled value to changes the value by applying certain algorithm , and I am left with a value such as 0.38292. How do I descale this value?

Because I cannot be sure that the resultant value is higher or lower that the range I used for the initial scaling, I cannot simply reverse the same formula I used.

Does anyone have any ideas??

1 Year
Discussion Span
Last Post by James_43

Just one. In an app long ago I need to scale video data to get the most out of an embedded display. So I didn't want to destroy the raw data so a second array would hold my scaled data and the original was left as-is.


Actually I've realised there isn't even a problem here, because the range of the second value doesn't matter. If the normalised value > 1 then we know it's larger, and the original calculations still churn out the same result!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.