# Y = mx + c offset conversion

#### rocketman46

Hi all,

I am just just trying to work out an offset conversion for a sensor I am using, but my transposition is not working out. OK below I will explain:

* Sensor 4 - 20mA coverts to 0 - 20mm/s rms

So:

y = m . x + c
4(mA) = m . 0(mm/s rms) + c therefore tidying up 4(mA) = 0(mm/s rms).m + c
20(mA) = m . 20(mm/s rms) + c therefore tidying up 20(mA) = 20(mm/s rms).m + c

So drawing graph out on paper I make x = 1

Therefore, 20(mA) = 1 . 20(mm/s rms) + c

Transposing 20mA - 20 = c

c = -19.98mA/C

y (mA) = x(mm/ r rms) + c

y (mA) - c = x(mm/ r rms)

so working formula back:

y (mA) - c = x(mm/ r rms)

7mA -(-19.98mA/C) = 26.98mm/ s rms, which is wrong?

Can somebody help with what I am doing wrong.

#### HallsofIvy

Homework Helper
In order to map 4 to 20 into 0 to 20 you have to translate the left endpoint from 4 to 0 and then stretch the interval from length 16 to length 20. So x ma is mapped into (20/16)(x- 4)= (5/4)(x- 4)= (5/4)x- 5= 1.25x- 5 mm/s rms. A reading of 7 ma would be mapped to 1.25(7)- 5= 3.75 mm/s rms.

#### DEvens

Gold Member
Ok, your explanation of what you are trying to do is pretty confusing. I am having to guess a lot of what is going on here.

It seems like you have a sensor that produces a current, and you want to relate that current to the speed of an object the sensor is "looking" at. That means that speed is "y" and current is "x", and you want y=mx + c. You read current, apply the formula, and get speed.

It looks like you get a reading of 4 mA at a speed of 0 mm/s. And 20 mA at a speed of 20 mm/s. And you want to know what the speed is when you get a reading of 7 mA.

Is that right?

There are several things that are confusing me.
Why do you mention rms? As in "Therefore, 20(mA) = 1 . 20(mm/s rms) + c"?
What is the C in "c = -19.98mA/C"?

Anyway, you seem to be trying to fit a straight line to two points. So you just have to remember that m is "rise over run." So y changes by this much divided by x changes by that much, and that's m. Careful to get the sign right. And c is the value of y at x = 0.