Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I How to calculate slope for data set

  1. Sep 14, 2016 #1

    joshmccraney

    User Avatar
    Gold Member

    Hi PF!

    I have some data (y-value data and x-value data) which I can plot to make a curve (see attachment, the top curve). However, when trying to compute the slope of this data I have an issue (see attachment, the bottom "curve"). The formula I am using for slope is ##(y_{i+1}-y_{i-1})/(2 \Delta x)##.

    To me it seems the issue is I have way too much data. Many of the y data values for some small neighborhood in the domain are the same due to measurement errors (measuring can only be so accurate). Should I simply omit all but, say, every 10th data value? Is this scientifically acceptable (results will be published)?

    I can explain more if you need. Thanks!
     

    Attached Files:

  2. jcsd
  3. Sep 14, 2016 #2

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    It sounds like what you want to do is to fit a curve to the data. A couple of different things you could do are

    1. Find a function with a few parameters that has the broad shape of the curve you drew, then use optimization techniques to estimate those parameters by something like minimizing sums of squares of errors. this is a non-linear equivalent of linear regression.

    2. Aggregate data along the horizontal axis into bins and then just plot the average value for all observations in each bin.
     
  4. Sep 14, 2016 #3

    joshmccraney

    User Avatar
    Gold Member

    Thanks andrewkirk! I'm on it!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted