Equation of a graph, determined by (x,y) coordinates

In summary, to determine the equation of a plot created with Origin or Excel that passes through all given points in a dataset, one can use a trendline in Excel or a physical model with calculated values for the pressures and other relevant factors. Using a polynomial fit may not accurately represent the true form of the graph, and a cubic spline fit or Fourier series may be more appropriate. It is also recommended to consult online resources or seek expert advice for more information on this topic.
  • #1
superduke1200
57
1
Dear all,

given a dataset of (x,y) coordinates, how can someone determine the equation of a plot created with Origin or Excel that passes through all these points?

Depending on the dataset, it is safe to use a trendline ( i.e logarithmic, polynomial) in Excel. The problem is that the graph which will be generated, will provide an equation close to the one that is determined by the given dataset but not the "real" one.

It is a query that many people including me have and it would be thankful to read someone's recommendations.
 
Technology news on Phys.org
  • #2
Excel's linear fit minimises the sum of the least-square residuals - that is, it picks ##m## and ##c## in ##y=mx+c## to minimise the squared difference between your y values and your modeled y values, ##\epsilon=\sum_i(y_i-(mx_i+c))^2##, where your data points are the ##x_i## and ##y_i##. I don't know for certain, but I expect its log fit works by replacing ##x_i## with ##\log(x_i)## in the sum and otherwise doing the same thing.

There's loads online about least squares linear fits. If you can do calculus, all you do is solve ##\partial\epsilon/\partial m=0## and ##\partial\epsilon/\partial c=0## simultaneously.

Edit: I've seen Excel get the fits spectacularly wrong with large amounts of data. Some care (which Excel does not take) is needed computationally in that case.
 
Last edited:
  • #3
0 0,4
0,05 0,43
0,08 0,62
0,12 0,68
0,13 0,79
0,2 0,83
0,25 0,8
0,3 0,76
0,32 0,69
0,34 0,63
0,35 0,56
0,4 0,6
0,43 0,62
0,45 0,55
0,5 0,53
0,55 0,46
0,58 0,48
0,6 0,47
0,65 0,45
0,8 0,4

That is the data set that I was earlier talking about. I have included them in case someone wishes to plot them using Excel, Origin etc

I have included the graph that I have plotted using Excel. It is the Velocity profile of a carotid bifurcation artery and I want its exact equation.

My best approach goes with a 6th order polynomial fit but the ideal would be this exact scheme's equation
Καταγραφή.PNG
 

Attachments

  • Καταγραφή.PNG
    Καταγραφή.PNG
    4.3 KB · Views: 492
Last edited:
  • #4
Καταγραφή.PNG


My attempt using a 6th order polynomial fit
 

Attachments

  • Καταγραφή.PNG
    Καταγραφή.PNG
    3.8 KB · Views: 475
  • #5
superduke1200 said:
My best approach goes with a 6th order polynomial fit but the ideal would be this exact scheme's equation
In that case, you're going to need a physical model. There are infinitely many curves that will fit a finite set of points like this. You'll need to come up with a model that says "given heart systolic and diastolic pressures, I expect the velocity to be...", then find the pressures (and whatever else goes into your model - arterial diameters, heightn etc) that best fit your data.

If you don't have a model, all you are doing is smoothing your data somehow.

Note that your fit clearly has problems - presumably we're expecting this to cycle, and the slope at the right hand end is very different from the left hand end.
 
  • #6
Svein said:
It looks like a Poisson distribution...

Adj R square when applying a Poisson distribution is 0.79.

With the polynomial fit it is 0.92
Ibix said:
In that case, you're going to need a physical model. There are infinitely many curves that will fit a finite set of points like this. You'll need to come up with a model that says "given heart systolic and diastolic pressures, I expect the velocity to be...", then find the pressures (and whatever else goes into your model - arterial diameters, heightn etc) that best fit your data.

If you don't have a model, all you are doing is smoothing your data somehow.

Note that your fit clearly has problems - presumably we're expecting this to cycle, and the slope at the right hand end is very different from the left hand end.

Perhaps if I am able to employ more data points, I could get a better approach with the polynomial fit. A physical model is not available. I just got these data by estimating the data points on the graph.

Another approach could be splitting the data set into pieces, according to its shape. That is, employing a polynomial fit for the first say 10 data points, a linear fit or the next three data points etc
 
  • #7
superduke1200 said:
. A physical model is not available.
Then you're only guessing what the data inbetween the points looks like. That's fine - if the data's what you've got, it's what you've got. Just don't kid yourself that you know the "true form" of the graph.

Presuming that this data covers one complete heartbeat, I'd investigate modelling this with a Fourier series. That will guarantee that your result is periodic, and you can try dropping frequency components with low amplitudes if you want.
 
  • #8
Thank you both for your will to share your knowledge!
 
  • #10
You should consider a cubic spline fit through the points rather than a high-degree polynomial.
 

FAQ: Equation of a graph, determined by (x,y) coordinates

What is the equation of a graph?

The equation of a graph is a mathematical expression that describes the relationship between the x and y coordinates of points on the graph. It can be represented in various forms such as linear, quadratic, exponential, or logarithmic equations.

How do I determine the equation of a graph?

To determine the equation of a graph, you need to have at least two points with known coordinates on the graph. You can then use the slope formula or the point-slope formula to find the slope of the line and plug it into the general equation of that specific type of graph.

What is the significance of the x and y coordinates in the equation of a graph?

The x and y coordinates represent the independent and dependent variables, respectively, in the equation of a graph. The independent variable (x) can take on different values, while the dependent variable (y) is determined by the value of x and the equation.

Can the equation of a graph be used to predict future values?

Yes, the equation of a graph can be used to predict future values as long as the relationship between the x and y coordinates remains the same. However, it is important to note that predictions are not always accurate and can be affected by other factors.

Are there different methods for finding the equation of a graph?

Yes, there are different methods for finding the equation of a graph, depending on the type of graph. For linear graphs, you can use the slope-intercept form, point-slope form, or standard form. Other types of graphs may require different methods such as finding the best fit line for scatter plots.

Back
Top