Numerical differentiation of a dataset

In summary, the conversation discusses the difficulty of finding a numerical derivative for a dataset with "noise" that gets amplified. Various solutions are suggested, including smoothing out the data, using a "best fit" function, and incorporating a theoretical model to explain the noise. Techniques such as numerical quadrature, FIR and IIR filtering, and wavelet transforms are also mentioned as possible solutions.
  • #1
exmachina
44
0
I have a dataset in two columns X and Y, sorted in ascending values of X.

I'm trying to find its numerical derivative, however, the "noise" (it's very hard to see any noise in the dataset itself when plotted), but the noise gets massively amplified to the point where the numerical derivative looks utterly senseless.

How do people do this?
 
Mathematics news on Phys.org
  • #2
Have you tried smoothing out your data first? There are an incredible number of different ways to do so, you may want to try a quick literature search.
 
  • #3
You could try passing some sort of "best fit" function through the data and then simply differentiating that function.
 
  • #4
The dataset already seemed quite smooth upon an observation.
 
  • #5
Can you post it for us in some way? I think kj's "best fit" option would work if you can fit it reasonably well.
 
  • #6
exmachina said:
the numerical derivative looks utterly senseless.

How do people do this?

If you are willing to make the judgment that a rapdily varying derivative is a senseless result then you should be able to cite some theoretical model that explains why it shouldn't be. This would include a model for any noise. The problem is then how to incorporate this model into your calculations.

If you think there is no noise in the data, then you could use the multi-point methods for estimating numerical derivatives. (For some reason, the Wikipeida only hints at such methods in the article on numerical differentiatiion and links to its Finite Difference Coefficient Article: http://en.wikipedia.org/wiki/Finite_difference_coefficients for more information. An interesting series of lectures covering numerical methods useful in physics is on the Perimeter Scholars website. I don't recall which of these lectures explains the multi-point method. http://www.perimeterscholars.org/274.html The coding is done in FORTRAN.)
 
Last edited by a moderator:
  • #7
exmachina said:
I have a dataset in two columns X and Y, sorted in ascending values of X.

I'm trying to find its numerical derivative, however, the "noise" (it's very hard to see any noise in the dataset itself when plotted), but the noise gets massively amplified to the point where the numerical derivative looks utterly senseless.

How do people do this?
That's a typical problem with numerical differentiation. There is no magic bullet even for numerical quadrature / numerical integration, and numerical quadrature is easy compared to numerical differentiation.

Are those X values uniformly spaced, such as measurements taken once per hour over several days? If so, there are a number of techniques available that are far better (less noisy) than a simple forward or backward difference. Either a finite or infinite impulse response filter can be of aid. Another approach is to use wavelets.

Fewer techniques are available for nonuniformly sampled data. FIR and IIR filtering techniques pretty much assumes uniformly sampled data. Some, but not all, wavelet transforms assume uniformly sampled data.

Yet another approach is, as has been previously suggested, to fit the data to some model and analytically differentiate the resultant model.
 

What is numerical differentiation?

Numerical differentiation is a method used in mathematics and computer science to calculate the derivative of a function or dataset. It involves approximating the slope of a curve at a particular point by looking at the values of the function at nearby points.

Why is numerical differentiation important?

Numerical differentiation is important because it allows us to calculate the rate of change of a function or dataset, which is essential in many areas of science and engineering. It is also useful when the function does not have a known mathematical formula or when it is difficult to calculate the derivative analytically.

What are the different methods of numerical differentiation?

There are several methods of numerical differentiation, including forward difference, backward difference, central difference, and higher-order methods such as Richardson extrapolation. Each method has its own advantages and disadvantages, and the choice of method depends on the specific application.

How do I choose the best method for numerical differentiation?

The best method for numerical differentiation will depend on the specific function or dataset being analyzed. Some factors to consider when choosing a method include the accuracy and computational efficiency of the method, as well as the smoothness and complexity of the function.

What are the limitations of numerical differentiation?

Numerical differentiation can introduce errors due to the approximation process, and these errors can accumulate and lead to inaccurate results. It is also sensitive to noise and outliers in the dataset. Additionally, numerical differentiation may not be suitable for functions with discontinuities or sharp changes.

Similar threads

  • General Math
Replies
28
Views
4K
  • General Math
Replies
9
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
Replies
8
Views
1K
Replies
2
Views
1K
Replies
4
Views
2K
  • Science and Math Textbooks
Replies
18
Views
2K
Replies
7
Views
1K
  • General Math
Replies
11
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
Back
Top