POLYMATH Report          DEQ 
 Ordinary Differential Equations       2016-May-30 

Calculated values of DEQ variables
  Variable Initial value Final value Minimal value Maximal value
1 Cp 2 2 2 2
2 M 1000 1000 1000 1000
3 t 0 200 0 200
4 T0 20 20 20 20
5 T1 20 30.9524 20 30.9524
6 T2 20 41.3832 20 41.3832
7 T3 20 51.3174 20 51.3174
8 Tsteam 250 250 250 250
9 UA 10 10 10 10
10 W 100 100 100 100

Differential equations
1 d(T1)/d(t) = (W*Cp*(T0-T1)+UA*(Tsteam-T1))/(M*Cp)
2 d(T2)/d(t) = (W*Cp*(T1-T2)+UA*(Tsteam-T2))/(M*Cp)
3 d(T3)/d(t) = (W*Cp*(T2-T3)+UA*(Tsteam-T3))/(M*Cp)

Explicit equations
1 W = 100
2 Cp = 2.0
3 T0 = 20
4 UA = 10.
5 Tsteam = 250
6 M = 1000

Problem source text
# S. 11 - ODE System
# Heat Exchange
# Verified Final Values: T1 = 30.9524, T2 = 41.3832 , T3= 51.3174
# Ref.: Comput. Appl. Eng. Educ. 6: 175, 1998
d(T1)/d(t)=(W*Cp*(T0-T1)+UA*(Tsteam-T1))/(M*Cp)
d(T2)/d(t)=(W*Cp*(T1-T2)+UA*(Tsteam-T2))/(M*Cp)
d(T3)/d(t)=(W*Cp*(T2-T3)+UA*(Tsteam-T3))/(M*Cp)
W=100
Cp=2.0
T0=20
UA=10.
Tsteam=250
M=1000
t(0)=0
T1(0)=20
T2(0)=20
T3(0)=20
t(f)=200

Matlab formatted problem
Create m file called PolyOde.m and paste the following text into it.
% S. 11 - ODE System
% Heat Exchange
% Verified Final Values: T1 = 30.9524, T2 = 41.3832 , T3= 51.3174
% Ref.: Comput. Appl. Eng. Educ. 6: 175, 1998
function PolyOde
   tspan = [0 200]; % Range for the independent variable
   y0 = [20; 20; 20]; % Initial values for the dependent variables
   [t,y]=ode45(@ODEfun,tspan, y0);
   plot (t,y);
   xlabel('t');
   legend('T1','T2','T3');
   fprintf('T1 = %16.6f \n',y(length(y),1));
   fprintf('T2 = %16.6f \n',y(length(y),2));
   fprintf('T3 = %16.6f \n',y(length(y),3));
end

function dYfuncvecdt = ODEfun(t,Yfuncvec)
   T1 = Yfuncvec(1);
   T2 = Yfuncvec(2);
   T3 = Yfuncvec(3);
   W = 100;
   Cp = 2;
   T0 = 20;
   UA = 10;
   Tsteam = 250;
   M = 1000;
   dT1dt = (W * Cp * (T0 - T1) + UA * (Tsteam - T1)) / (M * Cp);
   dT2dt = (W * Cp * (T1 - T2) + UA * (Tsteam - T2)) / (M * Cp);
   dT3dt = (W * Cp * (T2 - T3) + UA * (Tsteam - T3)) / (M * Cp);
   dYfuncvecdt = [dT1dt; dT2dt; dT3dt];
end

General Settings
Total number of equations 9
Number of differential equations 3
Number of explicit equations 6
Reporting digits 8
Elapsed time 0.10 sec
Solution method RKF_45
Step size guess. h 1E-06
Truncation error tolerance. eps 1E-06
Calculated Intermediate data points 50

Calculated data points
    t T1 T2 T3
1 0 20 20 20
2 9.02874 26.7082 29.2651 29.9704
3 12.1524 27.895 31.6986 33.0636
4 17.55 29.2177 34.9522 37.7422
5 21.765 29.8381 36.7824 40.7567
6 24.033 30.0742 37.5582 42.1497
7 28.902 30.4257 38.8327 44.6396
8 34.285 30.6531 39.7728 46.6993
9 37.2021 30.7321 40.1334 47.5625
10 40.2915 30.7931 40.4304 48.3159
11 46.6915 30.871 40.8446 49.4565
12 49.8915 30.8943 40.9797 49.8614
13 53.0915 30.9108 41.0816 50.1825
14 56.2915 30.9227 41.1581 50.4359
15 62.6915 30.9372 41.2586 50.7905
16 65.8915 30.9415 41.2907 50.9118
17 69.0915 30.9446 41.3146 51.006
18 72.2915 30.9468 41.3324 51.0789
19 78.6915 30.9496 41.3555 51.1784
20 81.8915 30.9504 41.3627 51.2116
21 85.0915 30.9509 41.3681 51.237
22 88.2915 30.9513 41.3721 51.2564
23 94.6915 30.9519 41.3772 51.2825
24 97.8915 30.952 41.3788 51.2911
25 101.092 30.9521 41.38 51.2975
26 104.292 30.9522 41.3808 51.3024
27 110.692 30.9523 41.3819 51.3089
28 113.892 30.9523 41.3823 51.311
29 117.092 30.9523 41.3825 51.3126
30 120.292 30.9523 41.3827 51.3138
31 126.692 30.9524 41.383 51.3154
32 129.892 30.9524 41.383 51.3159
33 133.092 30.9524 41.3831 51.3163
34 136.292 30.9524 41.3831 51.3165
35 142.692 30.9524 41.3832 51.3169
36 145.892 30.9524 41.3832 51.317
37 149.092 30.9524 41.3832 51.3171
38 152.292 30.9524 41.3832 51.3172
39 158.692 30.9524 41.3832 51.3173
40 161.892 30.9524 41.3832 51.3173
41 165.092 30.9524 41.3832 51.3173
42 168.292 30.9524 41.3832 51.3173
43 174.692 30.9524 41.3832 51.3173
44 177.892 30.9524 41.3832 51.3173
45 181.092 30.9524 41.3832 51.3173
46 184.292 30.9524 41.3832 51.3173
47 190.692 30.9524 41.3832 51.3173
48 193.892 30.9524 41.3832 51.3173
49 197.092 30.9524 41.3832 51.3173
50 200 30.9524 41.3832 51.3174