Vector integration; is this the most correct and/or accurate calculation?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Stuart Hobson
il 13 Ago 2019
Commentato: Stuart Hobson
il 14 Ago 2019
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))
Risposta accettata
John D'Errico
il 14 Ago 2019
Modificato: John D'Errico
il 14 Ago 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.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!