MATLAB: How to plot multiple signals with unit step signal signal processing I need to plot this function: v(t)=(2t+1)[u(t)-u(t-1)]+3[u(t-1)-u(t-2)]+(-t+3)[u(t-2)-u(t-3)] Best Answer t=-5:0.1:5v=(2*t+1).*(heaviside(t)-heaviside(t-1))+3*(heaviside(t-1)-heaviside(t-2))+(-t+3).*(heaviside(t-2)-heaviside(t-3))plot(t,v,'linewidth',4) Related SolutionsMATLAB: Plotting unit step function Fs = 100; dt = 1/Fs; StartTime = -5; StopTime = 15; t = StartTime:dt:StopTime-dt; x = (t>1) - (t>2) + (t<2) - (t<3) + (t>3) - (t>4); figure; stairs(t,x); ylim([-1.2 1.2]); MATLAB: Plot unit step function You can use a ‘logical indexing’ approach:ustp = @(t) +(t>0); % Simple Unit Step Functiont = linspace(-5, 5);figureplot(t, ustp(t)-ustp(t-1))gridI will let you figure out how it works. Related QuestionPlotting the derivative of an “switch-funktion”
Best Answer