필터 지우기
필터 지우기

1D transient heat equation

조회 수: 3 (최근 30일)
Lindsay Mau
Lindsay Mau 2020년 7월 31일
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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by