2

I have a technical problem to solve. A sensor is sensing a value for "locked" and "neutral" to prevent fast switching of states because of tolerance and signal noise, a hysteresis must be used.

For example the value "512" must report "locked" but until the value of 499 the state will stay locked. Now because of different models and application, these values are not fixed and can change, so the value of hysteresis must be calculated by the formula.

I've collected the following examples:

First number represents lowest value before rise, second number is level for reporting "locked" and third value is the lower threshold for reporting "neutral" again

  1. 506 - 555 - 543 (9.91% rise from base, 2.1% fall from high to low)
  2. 506 - 627 - 583 (20.26% rise from base, 7.54% fall from high to low)
  3. 506 - 722 - 614 (30.75% rise from base, 17.59% fall from high to low)
  4. 506 - 840 - 666 (40.48% rise from base, 26.12% fall from high to low)
  5. 506 - 976 - 696 (48.77% rise from base, 40.23% fall from high to low)

The lowest acceptable value from locked would be 550, the highest is 1000.

I'm looking for a mathematical formula to calculate the actual number from the rise level that can be measures, for example i would need to calculate the following

$$506 - y - x$$

Where $y$ is any given value between 550 and 100, and $x$ becomes a value matching the pattern of above example

Can someone help me with this? I'm not very familiar with math.

Ottavio
  • 2,287
  • The last number (in the samples) seems to be related to the second number by approximately $$ y \approx 349.887 + 0.364x $$ So for example, for the third sample we get $$ 349.887 + 0.364\cdot 722 \approx 613 $$ Which is not too far from the reported $614$. I obtained the function by linear regression. – Matti P. Jul 17 '20 at 09:05
  • Thank you this works. Could you explain how exactly this can be calculated? I need apply for some other values – sgt_johnny Jul 31 '20 at 12:06
  • In reality, I used Excel and made the linear regression there. That's the quickest way and doesn't require you to calculate anything yourself. But if you want a thorough explanation, please read my answer to this question: https://math.stackexchange.com/questions/3076868/linear-regression-computation-as-y-ax/3076898#3076898 – Matti P. Jul 31 '20 at 12:12

0 Answers0