L01 - T01 - ODE Warmup Problem
L01 - T01 - ODE Warmup Problem
Heated Rod
Source: Appied Numerical Methods
Chapra, 3rd Edition
Heated Rod
L= 10 m
h’ = 0.05 m-2
T = 200 K 0 1 2 3 4 5
Ta = 300 K
Tb = 400 K
x= 2m
For node 1:
−𝑇𝑖−1 + 𝑘1 𝑇𝑖 − 𝑇𝑖+1 = 𝑘2
% Define the coefficients of boundary nodes
a(1,1)= k1;
a(1,2)=-1; › Apply the equation at each interior
b(1)=k2+Ta;
node
a(n,n-1)= -1;
𝑘1 −1 𝑇1 𝑘2 + 𝑇𝑎
a(n,n)= k1;
−1 𝑘1 −1 𝑇2 𝑘2
b(n)=k2+Tb; =
−1 𝑘1 −1 𝑇3 𝑘2
−1 𝑘1 𝑇4 𝑘2 + 𝑇𝑏
ME 626 ADVANCED NUMERICAL METHODS 2/27/2021 10
Matlab\Octave Code
% Define the coefficients of interior nodes
for i=2:n-1
a(i,i-1)=-1;
a(i,i)=k1;
𝑘1 −1 𝑇1 𝑘2 + 𝑇𝑎
a(i,i+1)=-1;
−1 𝑘1 −1 𝑇2 𝑘2
=
−1 𝑘1 −1 𝑇3 𝑘2
b(i)=k2;
−1 𝑘1 𝑇4 𝑘2 + 𝑇𝑏
endfor
b=b’; % Transverse b to column vector
dx T(5m) Et % Ea (%)