Plotting impulse functions on the same time axis with other functions in MATLAB I am trying to plot the following function:


I have to plot another function along with it all on the same plot. Got the other function working, but I can't seem to get this one working. The code below is my attempt at plotting the function:

t = 0:1:10;

for t=&gt;1 &amp;&amp; t&lt;=1

    n = 0:1;

end

plot(t,n)



Need help
The use of logical operators is not correct. A more generic verison is:

timeStart = -3; timeStop = 2; nSample = 1000;
time = linspace(timeStart,timeStop,nSample);
timeUp = 0; timeDown = 1; 
data = zeros(size(time));
data((time&gt;=timeUp) &amp; (time&lt;=timeDown)) = 1;
plot(time,data,'x-')