Get the analytic solution of transient heat equation

This is my problem: This is the transient heat transfer problem in 1D

and this is my code:

I can’t get the analytic solution.
Anyone could help me? thank you very much!