Vector integration; is this the most correct and/or accurate calculation?

2 visualizaciones (últimos 30 días)
Good day,
this seems to be a regular question topic; I unfortunately am not sure I have the correct understanding from the help files or description of the use of trapz.
I have a vector 'time' with a series of non-uniformly spaced time data points.
I have vectors 'P' and 'At' which are independant data points known at each specific time.
So I want to calculate the integral of (P x At dtime).
Is the correct use and/or most accurate use of trapz in this regard as follows:
Cstar_eff = trapz(time,(P.*At))

Respuesta aceptada

John D'Errico
John D'Errico el 14 de Ag. de 2019
Editada: John D'Errico el 14 de Ag. de 2019
This is a slightly complex question.
Is it the correct use of trapz? Of course.
Is it the most accurate possible way to integrate a data series? It is just trapezoidal rule, for god sakes. Trapezoidal rule is a good choice if there is any noise at all in your data. Higher order rules tend to amplify any noise, whereas trapezoidal rule is about as good as you can get in terms of not amplifying any noise, so it can be a minimum variance estimator, unless you need to use smoothing.
However, if your series represents a very smooth kernel, then trapezoidal rule may not be the best choice. You would be better off using a higher order rule. Perhaps a higher order Newton Cotes rule (Simpson's rule is the simple example that you might have heard of.) Or you could interpolate the points using a spline, then integrate the spline.

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by