I'm working on some electronics calculations at the moment and I'm trying to calculate a value. I have some number of resistance values ($r$). There should be some value $W $where, when subtracted from $r$, the answer, $s$, should be relatively consistent. I'll provide an example slightly further down.
$s=\frac{(r-w)}{b}$
A couple examples from some measurements, I've got 16 in total but here is 3:
w = 400
$s = \frac{(92979.9-400)}{255}=363.06$
$s = \frac{(87204.3-400)}{239}=363.20$
$s = \frac{(81278.2-400)}{223}=362.68$
Core of my Question: Is there a way I can calculate what value of $W$ would give me the most consistent value for $s$ without just plugging in a bunch of different numbers for $W$?
In reality what I'm doing here is taking a digital potentiometer (variable electronic resistor) and attempting to calculate the step value ($s$). I calculated the values for the resistance ($r$) based on some voltage and current measurements I took. There is some innate resistance that the wiper ($W$) on the potentiometer has that offsets my calculation by that value. The b is the step value I have told the potentiometer to set itself to. The ideal step value is $\frac{100000}{255}=392.157$ but there is some variance. I am trying to find as close to what that step value is as I can.
I used $400$ for $W$ because the datasheet says this value is typically around $400$ and it does seem relatively accurate. The step results vary a bit, with the extremes being [$363.20$Ω, $362.08$Ω], but I want to know if I can find a better value for the wiper than this if I use a different potentiometer that does not work out quite as nicely.
My goal is to be able to make a program take these values in, then calculate what the wiper value is.
P.S. I do not know what tags would be appropriate for this question, would love some input. I don't think programming is appropriate because it is not required, it is just what I want to use to find the answer.