1-d heat transfer equation
Afficher commentaires plus anciens
now i am wirte the heat equation code. it tisn't work ,,
L=10cm, dx=1cm n=10 T(11,200)
the initial condition is T(*,1)= 293K
the boundary condition is T(1,*)=373k , T(11,*)=T(10,*)
and this is my code
clear
clc
L=10;
n=11;
dx=L/n;
dt=0.005;
t=1;
nt=200;
alpha=0.001;
beta=alpha*dt*(1/(dx)^2);
T0=293;
T1=373;
for j=1:nt
for i=2:n-1
T1(i)=((1-2*beta)*T0(i)+beta*T0(i-1)+beta*T0(i+1));
end
end
plot(T1)
1 commentaire
KSSV
le 12 Juin 2020
Your T0 is a scalar, and you are using it as a vector.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Heat Transfer dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!