To plot the signal x(t) = u(t+1) - u(t-2) in MATLAB without using the heaviside() function, you can create the unit step function u(t) using simple logical conditions and then plot it.
Here is the MATLAB code to plot x(t):
333 chars17 lines
This code defines the time range, computes the unit step function u(t) using logical conditions, and then computes the signal x(t) = u(t+1) - u(t-2). Finally, it plots x(t) using the plot()
function.
Make sure to adjust the time range according to your requirement to get a clear plot.
gistlibby LogSnag