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.
3 件のコメント
Jan
2022 年 12 月 19 日
What is "u2"? Do you mean "u_integrated"?
Abdulhalim Saeed
2022 年 12 月 19 日
採用された回答
その他の回答 (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!
