How to integrate matrices in MATLAB ?
Afficher commentaires plus anciens
I want to do the following integration in MATLAB, given by this equation 

The data stored in ue is from a numerical simulation (i.e Discrete Data). T and Ly are given and are 5 and 80, respectively. The total simulation time is 500 s ( dy = 0.1 and dt = 0.01).
ue - is a matrix with 3x3 dimensions where u (t,y,x), t being the time of the points stored in the matrix, y is the points in the y-drection, x is the points in the x-direction.
My code is :
% Inner Integration
for t = 1:totaltime
for i=1:x
u_integrated(t,:,i) = (trapz(0:dy:Ly,ue(t,:,i))/Ly);
end
end
% Outer Integration
for t = 1:totaltime
for j = 1:y
for i = 1:x
u_outint(t,j,i) = (trapz(0:dt:T,u_integrated(t,j,i)))/(T);
end
end
end
I have tried to use the trapz function in MATLAB, but I am not sure whether my implementation is correct or not.
3 commentaires
Jan
le 19 Déc 2022
What is "u2"? Do you mean "u_integrated"?
Abdulhalim Saeed
le 19 Déc 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
