I want to write the following anonymous function in MATLAB.
I have a piecewise function. I want to turn this into a single expression. How can this be accomplished in MATLAB ?
$$f(x,t) = \begin{cases} 20e^{-4x^2} & \text{if $0 \leq t \leq T/2,$} \\ 0 & \text{otherwise.} \end{cases}$$