Skip to main content
6-Contributor
February 15, 2021
Question

Generate a function from a scatterplot

  • February 15, 2021
  • 2 replies
  • 1222 views

so i have two vectors. 

One is a time stamp 

the second is y axis data. 

 

so for each time stamp there is a corresponding data point

 

I need to plot this scatterplot somehow and then find a line of best fit. 

 

Then i need to take the integral of it. 

I have tried to use the regress function and the interp function without luck. All i get are errors. 

I cant find a good example online. 

The is just a simple 2d plot. Good old X and Y

Can someone help me with an example. 

I dont understand all the parameters that regress and interp are expecting. 

When i try to plot it just gives me an error. i cant post my sheet because of IP

2 replies

23-Emerald IV
February 16, 2021

In general: Unless you have a model of the phenomenon that describes the function you want to integrate, there's no better estimate of the total integral than just summing the datapoints you have.

[ You cannot add accuracy that is not present in your data.]

If you do have a model, it makes sense to fit the points to your model and potentially derive model parameters. That will give you a function, which you can integrate.

Please see the discussion here: https://community.ptc.com/t5/PTC-Mathcad/Direct-Integration-Problem-MathCAD/m-p/625854#M187108 .

 

Success!
Luc

12-Amethyst
February 16, 2021

I had a similar topic and it was solved very well here, have a look:

 

https://community.ptc.com/t5/PTC-Mathcad/Interpolation-between-points-in-Mathcad-Prime-3-0/m-p/711091#M194218

 

Basically a function which interpolates your datapoints was found with "curveexpert professional"

Afterwards the "genfit" function was used.

 

Regards