Question seems a bit un-understandable, for i didn't know how to ask it
Lets say i have a variable X and another variable X
for V = 160, X = 20
for V = 425, X = 255
Calculate X for V=285
I just need the equation for that, and a small explanation. Im guessing linear function, i have no idea how to solve it. It is not a homework question. I need to use it for some game im creating..
Well, we can use a linear function:
$$\text{f}\left(x\right):=\text{a}\cdot x+\text{b}\tag1$$
Now, we have two points:
So, we can set up a system of equations:
$$ \begin{cases} \text{f}\left(x_1\right):=\text{a}\cdot x_1+\text{b}\\ \\ \text{f}\left(x_2\right):=\text{a}\cdot x_2+\text{b} \end{cases}\tag4 $$
So, when we solve $\text{b}$ out of the system $\left(4\right)$:
$$\frac{\text{f}\left(x_2\right)-\text{b}}{x_2}=\frac{\text{f}\left(x_1\right)-\text{b}}{x_1}\space\Longleftrightarrow\space\text{b}=\frac{x_2\cdot\text{f}\left(x_1\right)-x_1\cdot\text{f}\left(x_2\right)}{x_2-x_1}\tag5$$
So, for $\text{a}$ we get:
$$\text{a}=\frac{\text{f}\left(x_1\right)-\frac{x_2\cdot\text{f}\left(x_1\right)-x_1\cdot\text{f}\left(x_2\right)}{x_2-x_1}}{x_1}\tag6$$
So, when we want to know $\text{f}\left(\text{n}\right)$, we get:
$$\text{f}\left(\text{n}\right):=\frac{\text{f}\left(x_1\right)-\frac{x_2\cdot\text{f}\left(x_1\right)-x_1\cdot\text{f}\left(x_2\right)}{x_2-x_1}}{x_1}\cdot\text{n}+\frac{x_2\cdot\text{f}\left(x_1\right)-x_1\cdot\text{f}\left(x_2\right)}{x_2-x_1}\tag7$$
So, for your problem we know:
$$x_1=20\space,\space\text{f}\left(x_1\right)=160\space,\space x_2=255\space,\space\text{f}\left(x_2\right)=425\space,\space\text{f}\left(\text{n}\right)=285\tag8$$
So, we get:
$$285=\frac{160-\frac{255\cdot160-20\cdot425}{255-20}}{20}\cdot\text{n}+\frac{255\cdot160-20\cdot425}{255-20}\space\Longleftrightarrow$$ $$\text{n}=\frac{285-\frac{255\cdot160-20\cdot425}{255-20}}{\frac{160-\frac{255\cdot160-20\cdot425}{255-20}}{20}}=\frac{6935}{53}\approx130.8490566037735849\tag9$$