numerical solution for heat equation

12 views (last 30 days)
How can I plot temperature vs z if there is noting given about z?
The code that I write for it is,
inits='T1(0)=10,T2(0)=10,T3(0)=10';
>> [T1,T2,T3]=dsolve('DT1=-2*T1+T2+10','DT2=T3-2*T2+T1','DT3=90-2*T3+T2',inits)
  1 Comment
Walter Roberson
Walter Roberson on 15 Dec 2023
T(z,t>=0) implies that you have a PDE not an ODE. dsolve() cannot handle PDE.

Sign in to comment.

Accepted Answer

Torsten
Torsten on 15 Dec 2023
I think your discretization should be done using the FV-method. Here, the volumes and areas of the bricks - expressed with dx, dy and dz - come into play.
syms T1(t) T2(t) T3(t) t
Ta = 10;
Tb = 90;
tplot = 10;
eqn1 = diff(T1,t) == T2-2*T1+Ta;
eqn2 = diff(T2,t) == T3-2*T2+T1;
eqn3 = diff(T3,t) == Tb-2*T3+T2;
eqns = [eqn1,eqn2,eqn3];
cond1 = T1(0)==Ta;
cond2 = T2(0)==Ta;
cond3 = T3(0)==Ta;
conds = [cond1,cond2,cond3];
[T1sol,T2sol,T3sol] = dsolve(eqns,conds);
hold on
fplot(T1sol,[0 tplot])
fplot(T2sol,[0 tplot])
fplot(T3sol,[0 tplot])
hold off
grid on

More Answers (0)

Community Treasure Hunt

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

Start Hunting!