1D transient heat equation

2 次查看(过去 30 天)
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

回答(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 个评论
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Heat and Mass Transfer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by