Effacer les filtres
Effacer les filtres

How to get the integral (function) from a vector?

3 vues (au cours des 30 derniers jours)
carlos g
carlos g le 19 Mar 2017
Commenté : carlos g le 20 Mar 2017
Dear all,
I have a vector than can be plotted and I would like to compute its integral. I don't mean the total area below, but how it evolves over the domain of integration. Basically, its "indefinite" integral. Is this possible? maybe via interpolation?
Thank you

Réponses (2)

Star Strider
Star Strider le 19 Mar 2017
I would use the cumtrapz function to integrate it. The last value is the value of the entire integral.
  1 commentaire
Image Analyst
Image Analyst le 19 Mar 2017
Or perhaps cumsum() depending on your philosophy of what integration means to you, or depending on the physics of the real world situation.

Connectez-vous pour commenter.


Roger Stafford
Roger Stafford le 19 Mar 2017
I wrote a function for the File Exchange which uses third order integration methods for discrete sets of points to obtain a cumulative integral, and is therefore usually more accurate than trapz or cumtrapz. It is located at:
http://www.mathworks.com/matlabcentral/fileexchange/19152-cumulative-cubic-integration .
  1 commentaire
carlos g
carlos g le 20 Mar 2017
Hi Roger,
It worked just perfectly, thanks a lot!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by