float fInterpol2(float x, float x1, float y1, float x2, float y2) //interpolation function getMaxPowerPriority { // x = input from the sensor // x1, x2 = boundary condition of the sensor input. // y1, y2 = boundary condition of the desired output. float y; // desired output. y = (((y2 - y1) / (x2 - x1)) * (x - x1)) + y1; if(y > y1) y = y1; if(y < y2) y = y2; return y; }
if ( y > y2 ) y = y2; if ( y < y1 ) y = y1;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)