Quiet@Remove["Global`*"];
SetDirectory[NotebookDirectory[]];
$HistoryLength=3;

mm=0.001;
d=10mm;
a=1.172*(10^(-5));
n=200;
(Subscript[T, 1])[t_]:=0;
(Subscript[T, n])[t_]:=0;
Δx=(d/(n-1));
tmax=1;
Tstart=800;
eqn[i_]:={(Subscript[T, i])'[t]==a*(((Subscript[T, i+1])[t]+(Subscript[T, i-1])[t]-2*(Subscript[T, i])[t])/((Δx)^2)),(Subscript[T, i])[0]==Tstart};
eqns=Flatten[eqn/@Range[2,n-1]];
nezname=(Subscript[T, #])[t]&/@Range[2,n-1];
teploty=(Subscript[T, #])[t]&/@Range[n];
sol=NDSolve[eqns,nezname,{t,0,tmax}][[1]];
xka=#*Δx&/@Range[0,n-1];
vys[t_]=Thread[{xka,teploty/.sol}];
pl[t_]:=ListPlot[vys[t],AxesLabel->{"x [m]","T[°C]"},PlotRange->{{0,d},{0,Tstart+10}},Joined->True,PlotStyle->{Thick,Red}];
Manipulate[pl[t],{t,0,tmax}]

n=20;
eqn[i_]:={(Subscript[T, i])'[t]==a*(((Subscript[T, i+1])[t]+(Subscript[T, i-1])[t]-2*(Subscript[T, i])[t])/((Δx)^2)),(Subscript[T, i])[0]==Tstart};
Flatten[Table[eqn[i],{i,n}]];

NDSolve[{D[T[t,x],t]==a*D[T[t,x],{x,2}],
T[t,0]==0,
T[t,d]==0,
T[0,x]==Tstart},T,{t,0,100},{x,0.,d}][[1]];

solNDS=NDSolve[{D[T[t,x],t]==a*D[T[t,x],{x,2}],
T[t,0]==Tstart*(1-Tanh[(10^3)t]),
T[t,d]==Tstart*(1-Tanh[(10^3)t]),
T[0,x]==Tstart},T,{t,0,100},{x,0.,d}][[1]];
Plot3D[T[t,x]/.solNDS,{t,0,100},{x,0.,d},PlotRange->All];
tepl[t_]:=T[t,x]/.solNDS;
pl2[t_]:=Plot[tepl[t],{x,0,d},PlotRange->{{0,d},{0,Tstart+10}},PlotStyle->{Thick,Blue},AxesLabel->{"x [m]","T[°C]"}];
Manipulate[Show[pl[t],pl2[t]],{t,0,1}]

Plot[Tstart*(1-Tanh[(10^3)t]),{t,0,tmax},PlotStyle->{Thick,Red}]

solNDS2=NDSolve[{D[T[t,x],t]==a*D[T[t,x],{x,2}],
T[t,0]==0.,
T[t,d]==0.,
T[0,x]==800*Tanh[1000*Sin[100*Pi*x]]},T,{t,0,1},{x,0.,d}][[1]];
Plot3D[T[t,x]/.solNDS,{t,0,1},{x,0.,d},PlotRange->All];
tepl2[t_]:=T[t,x]/.solNDS;
pl3[t_]:=Plot[tepl2[t],{x,0,d},PlotRange->{{0,d},{0,Tstart+10}},PlotStyle->{Thick,Blue},AxesLabel->{"x [m]","T[°C]"}];
Manipulate[Show[pl[t],pl2[t]],{t,0,tmax}]

Plot[800*Tanh[100*Sin[100*Pi*x]],{x,0,d}]