Integral of a Matrix Issue

1 Ansicht (letzte 30 Tage)
uki71319
uki71319 am 8 Nov. 2022
Bearbeitet: uki71319 am 27 Mär. 2023
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!!!!

Akzeptierte Antwort

Torsten
Torsten am 8 Nov. 2022
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 Kommentare
Torsten
Torsten am 16 Nov. 2022
Bearbeitet: Torsten am 16 Nov. 2022
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 am 16 Nov. 2022
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by