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??

Recommended Answers

All 2 Replies

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.