I expect this has been asked before...
How do I calculate points on a line?
If I have to points (x1,y1) and (x2,x2) how do I calculate any y value for a given x?
so if x1< x < x2 how do I calculate y?
Printable View
I expect this has been asked before...
How do I calculate points on a line?
If I have to points (x1,y1) and (x2,x2) how do I calculate any y value for a given x?
so if x1< x < x2 how do I calculate y?
There are several useful equations for a line. Here are some of them.The third equation will work for any value of X. X need not be between X1 & X2.
- Y = M*X + Y0, where M is the slope and Y0 is the Y-Intercept (value of Y when X is zero).
- (Y - Y1) = M*(X - X1), where M is slope and (X1, Y1) is a known point on the line.
- (Y - Y1) = (Y2 - Y1)*(X - X1)/(X2 - X1), where (X1, Y1) and (X2, Y2) are points on the line. I think this is the equation you want.
- X/A + Y/B = 1, where A and B are the X-Intercept and the Y-Intercept.
When using the second and third equations for computations, Y1 is usually changed in sign and put on the right side of the equals sign. The equations are shown as above because they are slightly easier to understand that way.