Derivative of Temperature vs time data

I have a CSV file with temperature data and time. I am trying to model the dynamic response of the temperature sensor, to do so I want to take the derivative of the data. I have used the "diff" command but my data just looks messy.

5 commentaires

Torsten
Torsten le 25 Fév 2025
Modifié(e) : Torsten le 25 Fév 2025
Maybe you have to smooth your data first. But we cannot tell because we don't have access to your data and we don't know how you applied "diff" on them.
dpb
dpb le 25 Fév 2025
Modifié(e) : dpb le 26 Fév 2025
Also, if the time intervals aren't exactly uniform, then you will get a more accurate response with
deriv=diff(temp)./diff(time);
That still won't solve the issue if there is noise in the data, but will help with non-uniform sampling if that's happening as in a polling-like sampling scheme rather than via a triggered A/D converter.
Walter Roberson
Walter Roberson le 25 Fév 2025
If your times are not equal step, then you probably want to use gradient
Sam Chak
Sam Chak le 25 Fév 2025
Modifié(e) : Sam Chak le 25 Fév 2025

Hi Ryan, the diff() function in MATLAB, when applied to the measured data, will return some values. But it does not magically give you a smooth and beautiful mathematical model, like dT/dt = f(T). Just for your info.

P.S. Same as gradient().

dpb
dpb le 26 Fév 2025
And, of course, it also presumes the times have been recorded with sufficient precision to be able to use them...one often finds a timestamp has been recorded but not with sufficient precision to be useful.

Connectez-vous pour commenter.

Réponses (1)

charan
charan le 12 Mai 2025

0 votes

Hi Ryan,
Here are some suggestions to calculate a smoother derivative of noisy data:

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Produits

Version

R2019b

Tags

Question posée :

le 25 Fév 2025

Réponse apportée :

le 12 Mai 2025

Community Treasure Hunt

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

Start Hunting!

Translated by