Integral of a Matrix Issue
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    uki71319
 el 8 de Nov. de 2022
  
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!!!!
0 comentarios
Respuesta aceptada
  Torsten
      
      
 el 8 de Nov. de 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_cart = 1/r(end) * trapz(r.',T.')
4 comentarios
  Torsten
      
      
 el 16 de Nov. de 2022
				
      Editada: Torsten
      
      
 el 16 de Nov. de 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
  Torsten
      
      
 el 16 de Nov. de 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.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



