Integral of a Matrix Issue

조회 수: 2 (최근 30일)
uki71319
uki71319 2022년 11월 8일
편집: uki71319 2023년 3월 27일
Dear all, i'm trying to integrate a matrix to get a radial average mean temperature along three axial positions; however the codes always return the same matrix vlaue, instead of a single T mean value along axial site..
Does anyone know how could i get a real mean temperature value at each axial dirctection?
r=[0,5,10,15]
T=[300,310,320,335;
302,312,322,337;
305,315,325,340;] % as matrix 3*4
R_t=15 % radius
T*r'
fun=@(r)T*r'
integral(fun,0,r_t,'ArrayValued',true)
T_mean=(2./(r_t).^2).*integral(fun,0,r_t,'ArrayValued',true)
The output:
T = 3×4
300 310 320 335
302 312 322 337
305 315 325 340
T*r':
ans = 3×1
9775
9835
9925
integral(fun,0,r_t,'ArrayValued',true):
ans = 3×4
1.0e+04 *
3.3750 3.4875 3.6000 3.7687
3.3975 3.5100 3.6225 3.7912
3.4312 3.5437 3.6562 3.8250
T_mean=(2./(r_t).^2).*integral(fun,0,r_t,'ArrayValued',true):
T_mean = 3×4
300.0000 310.0000 320.0000 335.0000
302.0000 312.0000 322.0000 337.0000
305.0000 315.0000 325.0000 340.0000
Thanks in advnce!!!!

채택된 답변

Torsten
Torsten 2022년 11월 8일
Why do you name the same radius R in the denominator R_T ? Both are equal to the cylinder radius (in your case 15, I guess).
r=[0,5,10,15];
T=[300,310,320,335;
302,312,322,337;
305,315,325,340];
Tr = r.*T;
T_mean_cyl = 2/r(end)^2 * trapz(r.',Tr.')
T_mean_cyl = 1×3
322.7778 324.7778 327.7778
%T_mean_cart = 1/r(end) * trapz(r.',T.')
  댓글 수: 4
Torsten
Torsten 2022년 11월 16일
편집: Torsten 2022년 11월 16일
1.
Because the area of the cylinder grows with r^2 and not with r and the high temperature between r=10 and r=15 is weighted much more than the low temperature between r=0 and r=10.
2.
Use
plot([0 15],[T_mean_test,T_mean_test],'b','MarkerSize',20)
instead of
plot(T_mean_test,'b.','MarkerSize',20)
3.
r=[0,5,10,15];
T=[300,310,320,335;
302,312,322,337;
305,315,325,340];
for i = 1:3
fun = @(rq)2*pi*rq.*interp1(r,T(i,:),rq,'spline')/(pi*r(end)^2);
T_mean_test(i) = integral(fun,r(1),r(end));
end
T_mean_test
T_mean_test = 1×3
321.4815 323.4815 326.4815
Torsten
Torsten 2022년 11월 16일
Sir, for Question 1, you said that cylinder goes with r^2, do you mean "the r inside the integral will becomes (r^2 /2) afterwards"? Right?
You must interprete the mean temperature as an area-weighted average, and the areas grow quadratically with r. Thus high temperatures for big r values influence the mean temperature more than low temperatures for small r. This is different for a plate where the areas are equal throughout.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by