Borrar filtros
Borrar filtros

1D transient heat equation

3 visualizaciones (últimos 30 días)
Lindsay Mau
Lindsay Mau el 31 de Jul. de 2020
I am trying to solve this matrix: T=[A]^-1[B]. Initially the temperature is at 80C, but changes as time increases. The change in time is 30 seconds and the number of iterations I want to code for is 120. The current code I have does not work. Somehow I need some guidance how how to update the matrix inside the for loop and display for T(1)-T(10).
n=120; %number of iterations
t=0; %initial time
dt=30; %change in time [seconds]
tmax = 3600; %cool for 1 hr
T_initial = [80; 80; 80; 80; 80; 80; 80; 80; 80; 80; 80]; %initial temperature
A=[-230,50,0,0,0,0,0,0,0,0,0;
50,-460,50,0,0,0,0,0,0,0,0;
0,50,-460,50,0,0,0,0,0,0,0;
0,0,50,-460,50,0,0,0,0,0,0;
0,0,0,50,-460,50,0,0,0,0,0;
0,0,0,0,50,-460,50,0,0,0,0;
0,0,0,0,0,50,-460,50,0,0,0;
0,0,0,0,0,0,50,-460,50,0,0;
0,0,0,0,0,0,0,50,-460,50,0;
0,0,0,0,0,0,0,0,50,-460,50;
0,0,0,0,0,0,0,0,0,50,-330];
B =[-14400;-28800;-28800;-28800;-28800;-28800;-28800;-28800;-28800;-28800;-16400];
for i=1 %initialize solution
T(i)=T_initial;
end
T(1)=T_initial;
while (t < tmax)
i=i+1;
t=t+dt;
for i=2:n-1
T(i) = A\B;
end
end

Respuestas (1)

Wilmer Alexander - Conferencista en Automatización y Robótica más influyente en Iberoamérica
clc
clear
A=[-230,50,0,0,0,0,0,0,0,0,0;
50,-460,50,0,0,0,0,0,0,0,0;
0,50,-460,50,0,0,0,0,0,0,0;
0,0,50,-460,50,0,0,0,0,0,0;
0,0,0,50,-460,50,0,0,0,0,0;
0,0,0,0,50,-460,50,0,0,0,0;
0,0,0,0,0,50,-460,50,0,0,0;
0,0,0,0,0,0,50,-460,50,0,0;
0,0,0,0,0,0,0,50,-460,50,0;
0,0,0,0,0,0,0,0,50,-460,50;
0,0,0,0,0,0,0,0,0,50,-330];
B =[-14400;-28800;-28800;-28800;-28800;-28800;-28800;-28800;-28800;-28800;-16400];
T=A\B
  1 comentario
Wilmer Alexander - Conferencista en Automatización y Robótica más influyente en Iberoamérica
Thanks for asking. Please accept my proposal if your questions were resolved. I remain at your disposal for any questions.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by