I'm working on the Black-Scholes equation, but I'm pretty new to financial modeling. Right now, I am trying to understand the Black-Scholes PDE. I understand that the Black-Scholes equation is given by \begin{equation*} \frac{\partial C}{\partial t} + \frac{1}{2}\sigma^2 S^2\frac{\partial^2 C}{\partial S^2} + rS \frac{\partial C}{\partial S} - rC = 0 \end{equation*} with initial condition \begin{equation*} C(S,T) = \max (S-K, 0) \end{equation*} and boundary conditions \begin{equation*} C(0,t) = 0 \hspace{35pt} C(S,t) \rightarrow S \text{ as } S \rightarrow \infty \end{equation*} and $C(S,t)$ is defined over $0 < S < \infty$, $0 \leq t \leq T$.
The transformed equation is \begin{equation*} \frac{\partial u}{\partial \tau} = \frac{\partial^2 u}{\partial x^2} + (k-1)\frac{\partial u}{\partial x} - ku \end{equation*}
The following matlab code implements this. My question is, what exactly is the form of the boundary conditions for the the transformed equation? I can't seem to understand the parameters (related to the boundary conditions) given in the Matlab code. Any related literature would be highly appreciated.
And as an additional question, for the following graph
you get the most payoff when you wait until t = 4 and S = $e^{0.5}$. Is this insight correct? Additionally, in the graph above, what is the implication? Since the payoff is greatest when time to go, $t$ is maximum, does this mean we should exercise the option early?