I want to define a function $y(t)$ that has 2 cases:
$$y(t)= \begin{cases} -1 & \text{for} & -T \lt t \leq 0 \\ 1 & \text{for} & 0 \lt t\leq T \end{cases} $$ where $T$ is an integer.
I already defined $t$ using linspace between $-T$ to $T$ in a resolution of 1000 points.
I was advised to use the command ones
, but I dont know how to apply it by the function terms.
Thank you.
y=[-ones(500,1);ones(500,1)];
$\endgroup$y
has nothing to do witht
, just the lengths of the two vectors must be the same.y
simply gives you the values, andt
defines where on the t-axis these values are located. That's the way it works. $\endgroup$sign
function and set the value fort=0
to be 1? $\endgroup$