How to solve heat equation on matlab ?

4 次查看(过去 30 天)
alaa akkoush
alaa akkoush 2018-2-14
重新打开: Walter Roberson 2018-12-20
dt=0.1;
dx=1;
D=0.002;%thermal coefficient
s=(D*0.1)/(1)^2; %s=D*dt/dx^2
T(1,1)=0.2;%initial condition
t=0:0.1:1;
x=0:1:10;
for n=1:length(t-1)
for j=2:length(x-1)
T(n+1,j)=s*T(n,j+1)+(1-2*s)*T(n,j)+s*T(n,j-1);
end
end
but the error I,m getting is in the matrix dimension :
Index exceeds matrix dimensions.
Error in untitled (line 13) T(n+1,j)=s*T(n,j+1)+(1-2*s)*T(n,j)+s*T(n,j-1);

回答(1 个)

Torsten
Torsten 2018-2-14
Use MATLAB's "pdepe".
Best wishes
Torsten.

类别

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