Arduino-Interpolation icon indicating copy to clipboard operation
Arduino-Interpolation copied to clipboard

wrong calculation when out of range

Open sova32 opened this issue 1 year ago • 0 comments

good day! i have wrong result when input value is out of range. my data:

double adcValues[131] = {656, 649, 643, 634, 627, 619, 613, 605, 596, 590, 584, 574, 568, 560, 553, 546, 538, 532, 524, 517, 509, 502, 496, 487, 481, 474, 467, 460, 454, 447, 440, 434, 428, 422, 412, 405, 399, 393, 387, 380, 375, 368, 364, 358, 353, 347, 341, 337, 330, 326, 320, 315, 310, 306, 301, 295, 291, 287, 282, 277, 272, 267, 264, 259, 255, 252, 247, 243, 238, 235, 231, 227, 224, 220, 217, 213, 210, 207, 204, 200, 197, 194, 190, 187, 185, 182, 179, 176, 172, 170, 168, 165, 162, 160, 158, 154, 152, 150, 148, 146, 144, 137, 135, 134, 132, 128, 127, 125, 123, 122, 120, 117, 115, 114, 113, 110, 108, 107, 105, 103, 102, 100, 99, 98, 96, 95, 93, 91, 90, 89, 88};
double temperatureValues[131] = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230};

i use this func: temperature = Interpolation::Linear(adcValues, temperatureValues, 131, adcRaw, false); i have wrong calculation whet data out of range. image

maybe it is not mistake. If in is not mistake what i do wrong? Thankyou!

sova32 avatar May 10 '24 16:05 sova32