Integral of a Matrix Issue

1 回表示 (過去 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 Center および File ExchangeNumerical 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