Help with math formula

danzar

New member
Joined
Dec 2, 2009
Messages
1
Hi, it has been years sinse I have been in school so please keep that in mind :).
My problem is I have a varable that ranges from -3.9 to 3.9 with that I am wanting to convert the numbers to an range of 0 to 360.
ex.
-3.9-------------- 0.0---------------3.9
0---------------180--------------360


I can not for the life of me figure out the formula for the conversion. any help would be great

Thanks Dan
 
danzar said:
Hi, it has been years sinse I have been in school so please keep that in mind :).
My problem is I have a varable that ranges from -3.9 to 3.9 with that I am wanting to convert the numbers to an range of 0 to 360.
ex.
-3.9-------------- 0.0---------------3.9..................(x)
0---------------180--------------360...................(y)


I can not for the life of me figure out the formula for the conversion. any help would be great

Thanks Dan
There are 3 points given - you can set up a quadratic to do this.

y = Ax[sup:29dki7e9]2[/sup:29dki7e9] + Bx +C

y(0) = 180 = C

y(-3.9) = A(-3.9)[sup:29dki7e9]2[/sup:29dki7e9] + B(-3.9) + 180 = 0 ? 3.9 * A - B = -180/3.9 ...............(1)

y(3.9) = A(3.9)[sup:29dki7e9]2[/sup:29dki7e9] + B(3.9) + 180 = 360 ? 3.9 * A + B = +180/3.9 ...............(2)

Now you can solve for A and B
 
How about a "conversion to angle" method also...

Imagine the conversion being done on the x axis, where we have
0[sup:2qfyil9r]0[/sup:2qfyil9r] on the left, 180[sup:2qfyil9r]0[/sup:2qfyil9r] in the middle and 360[sup:2qfyil9r]0[/sup:2qfyil9r] on the right.
Then -3.9 corresponds to 0[sup:2qfyil9r]0[/sup:2qfyil9r], 0 to 180[sup:2qfyil9r]0[/sup:2qfyil9r] and 3.9 to 360[sup:2qfyil9r]0[/sup:2qfyil9r].

To convert to an angle we use inverse Cosine (arcCos).

We want to go from 0 to 180 instead of 0 to 360 in this case, so we use half angles.
Also the "sign" of the variable is the wrong way around for Cosine, so we write y=-3.9Cos(angle/2).

Then, angle = 2Cos[sup:2qfyil9r]-1[/sup:2qfyil9r](y/[-3.9])

.
 
Although, as you are converting a variable,
you may be looking for a direct linear conversion.

In that case, if "y" represents your values from 0 to 360 and "x" represents your values from -3.9 to 3.9,

add 3.9 to get x+3.9 ranges from 0 to 7.8,
the scale factor is 360/(7.8), which we multiply 7.8 by to get 360.

Therefore y = (x+3.9)360/(7.8) gives a linear conversion.

The procedure is
(a) add 3.9 to get a range from 0 to 7.8
(b) divide by 7.8 to get a range from 0 to 1
(c) multiply by 360 to get a range from 0 to 360
 
Top