6. 41 A train departs from station A, accelerating at 
0.5 km/min ${ }^{2}$, and after 
2 minutes, it continues at a constant speed for another 
7 minutes, then decelerates at 0.5 km/min ${ }^{2}$ to a stop at station B, where it remains stationary for 2 minutes. Draw the velocity-time graph for the train's journey from station A to station B, and derive the function for the distance traveled as a function of time. Determine the valid range of time values for these functions.
When $0 \leqslant t \leqslant 2$, $S=\frac{1}{2} a t^{2}=\frac{t^{2}}{4}$;
When $2<t \leqslant 9$, $S=\frac{2^{2}}{4}+(t-2)=1+t-2=t-1$;
When $9<t \leqslant 11$, $S=(9-1)+(t-9)-\frac{1}{2} a(t-9)^{2}$
$$
\begin{array}{l}
=t-1-\frac{1}{4}(t-9)^{2} \\
=\frac{1}{4}\left(-t^{2}+22 t-85\right) ;
\end{array}
$$
When $11<t \leqslant 13$, $S=\frac{1}{4}\left(-11^{2}+22 \times 11-85\right)=9$.