Rate of Change - Derivative of experimental data

Does anyone have any advice on determining the instantaneous rate of change for strain or force data for multiple cycles? If there is a wasy or function to help with taking the derivative of a curve in MatLab? I've tried using the diff() function but the results give me a value in the thouands when the peak instantaneous loading rate I received from LabView is only in the hundreds. I can attach my current code if you would like to see it, but unfortanutely I can't post the experimental data I have.

1 commentaire

Sam Chak
Sam Chak le 24 Juin 2022
Perhaps considering to post only a fraction of the data, say 10 points, or 10% of the data (if not too large).

Connectez-vous pour commenter.

Réponses (2)

Star Strider
Star Strider le 24 Juin 2022

0 votes

I usually do something like this —
dydx = gradient(y) ./ gradient(x);
This assumes the independent variable ‘x’ and the dependent variable ‘y’ are both vectors of the same length. See the documentation on gradient for details.

4 commentaires

Star Strider,
I tried your suggestion and receive the same results with the value in the thousands. This just seems off to me because I'm working with strain data and the applied load to the structure was only moving at about 4mm/s. Just hard for me to believe the strain rate is that high when it did take ~2.5 seconds to reach peak strain.
I assumed that your data are relatively noise-free. If that is not the case, they will have to be filtered or smoothed to remove the noise first.
I have used a lowpass filter to help smooth the data. The curves are relatively smooth but when the gauge is being unloaded and the signal settles before beginning a new cycle, there seems to be some noise there. I may need to figure out how to use a moving average to help smooth the data at those points.
There are several options, among which is filloutliers that detects outliers and interpolates them. Like all signal processing tasks, you will need to experiment to get the desired result.

Connectez-vous pour commenter.

John D'Errico
John D'Errico le 24 Juin 2022
Modifié(e) : John D'Errico le 24 Juin 2022

0 votes

If your data is smooth enough, then the direct gradient calls that Star shows are ok. The problem is, if there is any noise in your data, then using the finite differences from gradient may be a bad idea, as they will amplify the noise. Then you will benefit form a Savitsky-Golay style of filter. The idea is to use a moving polynomial approximation at each point to estimate the slope.
I posted movingslope on the File Exchange, which does exactly that, allowing you to choose the length of the moving filter, as well as the local polynomial order.
However, I recall it assumes your data curve is equally spaced in x. If you lack equally spaced data in x, then if you have any noise, you can still do something, but it will be way less efficient.

Catégories

Commenté :

le 24 Juin 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by