B. Please do the followings, %1 t=-5:0.01:5 subplot(9,1,1) plot(t,u(t-1),'g') subplot(9,1,2) plot(t,u(2*t+4),'m') subplot(9,1,3) plot(t,u(3*t+1)+u(t-1)+u(t-3)-3*u(t-5),'b') subplot(9,1,4) plot(t,ramp(t+1),'r') subplot(9,1,5) plot(t,ramp(t+1)-2*ramp(t)+ramp(t-1),'r') subplot(9,1,6) plot(t,ramp(t+1)-2*ramp(t-4),'r') subplot(9,1,7) plot(t,imp(2*t-1)+imp(3*t-2)+imp(4*t+3)+imp(2*t-4),'m') subplot(9,1,8) plot(t,u(t-2)+imp(t-1)+u(t+4),'y') subplot(9,1,9) plot(t,u(t+1)+imp(t-2),'c') %2 n = -5:0.01:5 subplot(6,1,1) stem(n,impDT(n-2),'g') subplot(6,1,2) stem(n,impDT(n-2)+impDT(2*n-6)+impDT(n-2)+impDT(n-2),'m') subplot(6,1,3) stem(n,stepDT(n-2)-stepDT(n-5),'b') subplot(6,1,4) stem(n,stepDT(n-2)-impDT(n-5),'r') subplot(6,1,5) stem(n,impDT(n-2).*n.^2 + stepDT(n-2) +1,'c') subplot(6,1,6) stem(n,rampDT(n)-2*rampDT(n-2)+rampDT(n-4),'f') ------------------------------------------------------------------------- %question1% n=-10:0.01:10; subplot(7,1,1) stem(n,impDT(n-3),'g') subplot(7,1,2) stem(n,impDT((2*n)-2)+impDT((2*n)-6)+impDT((2*n)-10)+impDT(n-8),'y') subplot(7,1,3) stem(n,stepDT(n+2)-stepDT(n-5),'m') subplot(7,1,4) stem(n,stepDT(n+2)+impDT(n-5),'r') subplot(7,1,5) stem(n,(impDT(n-3).*(n.^2))+stepDT(n-4),'c') subplot(7,1,6) stem(n,rampDT(n)-(2*rampDT(n-2))+rampDT(n-4),'r') subplot(7,1,7) stem(n,rampDT(n+2)-(2*rampDT(n-2))+rampDT(n-6),'m') %question2% %write this in command window% t=-10:0.01:10; subplot(5,1,1) plot(t,u(t-2)+imp(t-5),'g') subplot(5,1,2) plot(t,u(t+1)+imp(t)-u(t-3)+ramp(t-6),'m') subplot(5,1,3) plot(t,u(t)+u(t-1)-3*imp(t-5)+u(t-8)-3*u(t-10),'b') subplot(5,1,4) plot(t,ramp(t)-3*ramp(t-4)-imp(t-6)+u(t-8).*t,'r') subplot(5,1,5) plot(t,2*u(t+2)+u(t)+5*imp(t-3)-imp(t-5).*t.^2,'m') %question3% %write this function in m-file and save it as x1.m% function y=x1(t) y=exp(-(t.^2)).*u(t)-ramp(t).*(t.^2); %write this function in m-file and save it as x2.m% function y=x2(n) y=cos(n).*u(n).*(n.^2); %write this in command window% t=-20:0.01:20; n=-20:20; subplot(2,1,1) plot(t,x1(t),'g') subplot(2,1,2) stem(n,x2(n),'m') ---------------------------------------------------------- %question4% %write this function in m-file and save it as pieceu.m% function y=pieceu(t,epsilon) for i=1:length(t) if t(i)<=(-1*epsilon) y(i)=0; elseif (-1*epsilon)<=t(i) && t(i)<=epsilon y(i)=(1/(2*epsilon))*t(i); elseif epsilon<=t(i) y(i)=1; else y(i)=0; end end %write this in command window% t=-10:0.01:20; plot(t,pieceu(t,epsilon)) xlabel('t values') ylabel('x values') title('x values versus t values') --------------------------------------------------- %question5% % Define the time range t = -5:0.01:5; % Define the signals signal1 = ramp(-t); signal2 = -ramp(-t-2); signal3 = -2*u(-t-2); signal4 = imp(t); % Plot each signal separately subplot(4,1,1); plot(t, signal1, 'r'); title('Signal 1: ramp(-t)'); xlabel('Time'); ylabel('Amplitude'); subplot(4,1,2); plot(t, signal2, 'g'); title('Signal 2: -ramp(-t-2)'); xlabel('Time'); ylabel('Amplitude'); subplot(4,1,3); plot(t, signal3, 'b'); title('Signal 3: -2u(-t-2)'); xlabel('Time'); ylabel('Amplitude'); subplot(4,1,4); plot(t, signal4, 'm'); title('Signal 4: imp(t)'); xlabel('Time'); ylabel('Amplitude'); % Add all the signals together y = signal1 + signal2 + signal3 + signal4; % Plot the combined signal figure; plot(t, y, 'k'); title('Combined Signal'); xlabel('Time'); ylabel('Amplitude'); %question6% %write this in command window% t= -20:0.01:20; subplot(5,3,1) plot(t,0.5*ramp(t+1),'Linewidth',3) subplot(5,3,2) plot(t,0.5*u(t),'Linewidth',3) subplot(5,3,3) plot(t,0.5*ramp(t+1)+0.5*u(t),'m','Linewidth',3) subplot(5,3,4) plot(t,-0.5*ramp(t),'Linewidth',3) subplot(5,3,5) plot(t,0.5*ramp(t+1)+0.5*u(t)-0.5*ramp(t),'m','Linewidth',3) subplot(5,3,6) plot(t,ramp(t-1),'Linewidth',3) subplot(5,3,7) plot(t,0.5*ramp(t+1)+0.5*u(t)-0.5*ramp(t)+ramp(t-1),'m','Linewidth',3) subplot(5,3,8) plot(t,-3*ramp(t-2),'Linewidth',3) subplot(5,3,9) plot(t,0.5*ramp(t+1)+0.5*u(t)-0.5*ramp(t)+ramp(t-1)-3*ramp(t-2),'m','Linewidth',3) subplot(5,3,10) plot(t,-0.5*u(t-2.5),'Linewidth',3) subplot(5,3,11) plot(t,0.5*ramp(t+1)+0.5*u(t)-0.5*ramp(t)+ramp(t-1)-3*ramp(t-2)-0.5*u(t-2.5),'m','Linewidth',3) subplot(5,3,12) plot(t,2*ramp(t-2.5),'Linewidth',3) subplot(5,3,13) plot(t,0.5*ramp(t+1)+0.5*u(t)-0.5*ramp(t)+ramp(t-1)-3*ramp(t-2)-0.5*u(t-2.5)+2*ramp(t-2.5),'m','Linewidth',3) subplot(5,3,14) plot(t,-0.5*u(t-4),'Linewidth',3) subplot(5,3,15) plot(t,0.5*ramp(t+1)+0.5*u(t)-0.5*ramp(t)+ramp(t-1)-3*ramp(t-2)-0.5*u(t-2.5)+2*ramp(t-2.5)-0.5*u(t-4),'m','Linewidth',3) %question7% %write this function in m-file and save it as pieceu2.m% function y=pieceu2(t) for i=1:length(t) if t(i)<=(-10) y(i)=sin(t(i)); elseif (-10)<=t(i) && t(i)<=10 y(i)=imp(t(i)); elseif 10<=t(i) y(i)=u(t(i)); else y(i)=0; end end %write this in command window% t= -30:30; plot(t,pieceu2(t))