×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to get slope of discrete data

How to get slope of discrete data

How to get slope of discrete data

(OP)
Hi,
I have discrete data which can be some kind of curve. Now if we don't use a function to fit the data, and just based on these discrete data, can we get the approximate slope?

Thanks.

RE: How to get slope of discrete data

I'm not understanding your requirements.  A "slope," by definition, implies a model, i.e., that the data fits a straight line.  If you have no model, you have nothing but raw data.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

RE: How to get slope of discrete data

(OP)
In matlab, I just find that we can use function 'diff' to calculate the approximate slope.

if we have y-x data, then diff(y)./diff(x) gives rough slopes at different points.

RE: How to get slope of discrete data

diff()./diff() is the obvious answer.  gradient() is better.  There's no rocket science involved, but it does mean you don't need to do all the end treatment stuff yourself.

- Steve

RE: How to get slope of discrete data

That's fine if you have ZERO noise and ZERO measurement error.  If you do have noise or measurement errors, then the slopes you generate are going to be relatively meaningless.

If your data doesn't fall on a line, then I'm not sure what you're trying to accomplish.  If your trying to interpolate or do a prediction, then you should be fitting to a polynomial or something similar to mitigate the noise impact.

If your data are on a line, then you should fit to a line to get the best data possible.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

RE: How to get slope of discrete data

(OP)
Thank you all. My data is quite good.

I will try both diff (or gradient) and fitting to a simple function.

Mapi

RE: How to get slope of discrete data

Perhaps you need to explain what the end goal is, and what the data represents.  Have you even graphed the data?  Why are you going through this exercise without knowing what the result should look like.  Seems like creating unnecessary busywork.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

RE: How to get slope of discrete data

(OP)
My data is stress-strain data (nonlinear curve). I need to determine the Young's modulus (the slope).

Mapi

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources