Converting Piecewise function into a single expression in MATLAB

111 Views Asked by At

I have a piecewise function. I want to turn this into a single expression. How can this be accomplished IN MATLAB and what is the general procedure?

$$f(x,t) = \begin{cases} 20e^{-4x^2} & \text{if $0 \leq t \leq T/2,$} \\ 0 & \text{otherwise.} \end{cases}$$

1

There are 1 best solutions below

0
On BEST ANSWER

You can write $$f(x,t)=20e^{-4x^2}\Theta(T/2-t), t\in (0,\infty)$$ The Heaviside step function is defined as: $\Theta(z\ge 0)=1, \Theta(z<0)=0.$