I have tried to solve 1-D Conduction Steady state heat transfer problems in Matlab (see below).
Here is the 1-D model:
T''[x] == 0, T[0] == 100, T'[100] == 0
Analytical Solution:
T[x] = 100 for x: [0, 100]
I am so suprised that so many iterations (2,500,000) are required for a correct solution (here:T=100 for every node)...
Is it true that we need so many iterations for such a very simple ODEs using FD? Or?
Update:
@ConvexHull: the numerical solution is equal to the analytical solution if k = 2,500,000 is used. (Just run it )
The 1-D Conduction Steady state heat transfer in Matlab code looks like:
clc
clear all
L=100;
N=1000;
dx=L/(N-1);
T = zeros(N,1);
Tb = 100; % initial temperature
k = 1500000;
T(1,1)=Tb;
for j=1:k
for i=2:N-1
T(i,1)=(T(i+1,1)+T(i-1,1))/2;
end
T(N,1) = T(N-1,1);
end
xx= 0:dx:L;
plot(xx,T)
ylim([0 100])