Answer the question
In order to leave comments, you need to log in
Finding on the graph the value of Y, knowing X. How can it be implemented?
Good evening. Let's say I build a graph (connect 3 points). Manually, if I need to find the value of Y, knowing the value of X, I simply find it at the intersection with the graph. How can this be done in a C# program? Not good at programming
Answer the question
In order to leave comments, you need to log in
If all points are known - then the shape of the graph between each two points can be considered a straight line - that is, a line - the value is found through a linear equation.
neighboring points [x1,y1] and [x2,y2] are known, we find the coefficients of the linear equation:
(y2-y1)/(x2-x1)=a
y1-x1*a=b
we substitute here
y=x*a+b
we consider desired value between these two points.
in programming, you only need to find which points to take in order to find the desired value - by looping through an array with points.
If 2 points are too rough, then you can build a curve for every 3 points - it will be more accurate, but more difficult.
https://en.wikipedia.org/wiki/%D0%90%D0%BF%D0%BF%D...
en-wiki.org/wiki/%D0%98%D0%BD%D1%82% D0%B5%D1%80%D0...
https://en.wikipedia.org/wiki/%D0%9C%D0%B5%D1%82%D...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question