% Example2_29_data.m
%
% generate data for Example 2.29 and create Figure 2.10
L = 0.05;
% SI units  W/m^2, W/m^2-K, m^2/s, W/m-K
q0 = 50E3; h = 0.1E3; alpha = 25e-6; k=0.05e3; T0=20;  Tinf=20;
dt = 1; % s
tf = 100; % final time in seconds
Bi = h*L/k;
t = [ 0:dt:tf ];
tdim = alpha*t/L^2;
TX22 = fdX22B10T0( [0 1], tdim, 15);
TX23 = fdX23B10T0( [0 1], tdim, Bi);
figure(1); clf;
plot(t, q0*L/k*TX22(:,1)+T0, 'r-', t, q0*L/k*TX22(:,2)+T0, 'b-', ...
     t, q0*L/k*TX23(:,1)+T0, 'r--', t, q0*L/k*TX23(:,2)+T0, 'b--', 'linewidth', 1.0 )
xlabel('Time, seconds')
ylabel('Temperature, C')
legend('X22, x=0', 'X22, x=L', 'X23, x=0', 'X23, x=L', 'location', 'northwest' )
text(35,50,'x = 0');  text(42,30,'x = L');
% uncomment line below to save data
save Example2_29_data TX22 TX23
% print the 600 dpi figure to tiff format
fig=figure(1);
print(fig,fullfile(pwd, 'Figure2_10.tif'),'-dtiff','-r600')