Derivative of Temperature vs time data
Show older comments
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 Comments
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
on 25 Feb 2025
If your times are not equal step, then you probably want to use gradient
dpb
on 26 Feb 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.
Answers (1)
charan
on 12 May 2025
0 votes
Hi Ryan,
Here are some suggestions to calculate a smoother derivative of noisy data:
- Smoothing the data by using smoothing filters and moving averages can help reduce noise. Refer to the following documentation: https://www.mathworks.com/help/curvefit/smoothing-data.html
- Removing outliers from the data and normalizing the signal can help improve the derivative.
- Curve fitting can be done to the data to obtain a functional representation of the data and then differentiate the fitted curve to obtain a better derivative. Refer to the following documentation: https://www.mathworks.com/help/curvefit/example-differentiating-and-integrating-a-fit.html
The following MATLAB answer might be useful to you: https://www.mathworks.com/support/search.html/answers/253882-differentiating-a-noisy-position-signal.html
Categories
Find more on Smoothing and Denoising in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!