%代码如下:
clear;clc;
t=-10:0.01:10;
u1=0.5+0.5.*sign(t);
u2=0.5+0.5.*sign(t-4);
f1=(-t+4).*(u1-u2);
figure(1);plot(t,u1);title('f(t)=u(t)');xlabel('t');grid on;
figure(2);plot(t,u2);title('f(t)=u2(t)');xlabel('t');grid on;
figure(3);plot(t,f1);title('f(t)');xlabel('t');grid on;