clc;clear all;close all;
L = 1;
x = linspace(0,L,50);
t = linspace(0,1,50);
% t = [linspace(0,0.05,20), linspace(0.5,5,10)];
m = 0;
lambda = 1.0;
sol = pdepe(m,@(x,t,u,dudx)heatpde(x,t,u,dudx,lambda),@heatic,@heatbc,x,t);
sol1 = 1-sol(:,:,1); % Don't know why you want to plot 1-theta instead of theta
% colormap hot
figure(1)
surf(x,t,sol1);
% imagesc(x,t,sol)
% colorbar
% plot3(x,t,sol)
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Fig 12.1-1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx,lambda)
c = 1;
f = dudx;
s = -lambda^2*u;
end
function u0 = heatic(x)
u0 = 0;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = 0.0;
ql = 1.0;
pr = ur-1 ;
qr = 0.0;
end