nzs = 100;
z = linspace(0,1,nzs)';
kvec = [0, 2, 10, 30, 100];
cs = zeros(length(z), length(kvec));
for i = 1: length(kvec)
k = kvec(i);
if (k == 0)
cs(:,i) = 1-z;
else
cs(:,i) = sinh(sqrt(k).*(1-z))./sinh(sqrt(k));
end
end
figure()
plot(z, cs)
store = [z, cs];
save csz.dat store
%
% check out the transient solution also
% jbr; 11/8/2013
%
nk = 3;
k = kvec(nk);
tvec = [0, 0.001, 0.005, 0.01, 0.05, 0.1, 1.0]';
nts = length(tvec);
nterms = 25;
c = zeros(nzs, nts);
for j = 1:nts
t = tvec(j);
sum = 0;
for n = 1:nterms
n2p2 = n*n*pi*pi + k;
term = (-1)^n*(n/n2p2)*sin(n*pi*(1-z))*exp(-n2p2*t);
sum = sum + term;
end
c(:,j) = cs(:,nk) + sum*2*pi;
end
figure()
plot(z,c)