Effacer les filtres
Effacer les filtres

Double & Triple Integration with tabular data

2 vues (au cours des 30 derniers jours)
Sreedhar
Sreedhar le 6 Nov 2014
Commenté : Sreedhar le 7 Nov 2014
Hi
The function dblquad(fun, xmin, xmax, ymin, ymax, tol) can be used for double integration over x and y if the function is known, Similarly for 3D integration the function triplequad(..) can be used.
If, however, I have the x and y data in tabular form (eg. experimental points), what are the MATLAB functions for the double and triple integrations ?
Thanks in advance

Réponse acceptée

Roger Stafford
Roger Stafford le 6 Nov 2014
Modifié(e) : Roger Stafford le 6 Nov 2014
You can use Matlab's 'trapz' successively for this purpose. The easiest case is integrating over a rectangular region in (x,y) - that is, where the tabular data, T(x,y), is defined over a rectangular mesh of (x,y) values. Let x and y be vectors of the (x,y) values along the two edges of the rectangular table.
[X,Y] = meshgrid(x,y);
T = (The array of tabular values corresponding to X and Y)
I = trapz(y,trapz(x,T,2)); % <-- The double integral
You should realize that the accuracy of this method is limited by how closely-spaced the x and y values are in the rectangle. For higher order integration than the trapezoidal method there are some algorithms given in the MatLab File Exchange.
  1 commentaire
Sreedhar
Sreedhar le 7 Nov 2014
Roger Thank you for the answer. In this formula I = trapz(y,trapz(x,T,2)); % <-- The double integral
can y and x be interchanged ? In the case of a triple integral what is the formula ?
Can you post some examples ?
TIA

Connectez-vous pour commenter.

Plus de réponses (0)

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