How to integrate matrices in MATLAB ?
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
