ts = 0:.1:22*pi/2;
s = 0;
for jj=1:20
    s = s+sin(ts-jj*(pi/2)).*heaviside(ts-jj*pi/2);
end
plot(ts/pi,s,'LineWidth',3)
axis([0 11 -0.1 1.5])
xlabel('t/\pi','FontName','Times','FontSize',28,'VerticalAlignment','top');
ylabel('y','FontName','Times','FontSize',28);
set(gca,'FontSize',24,'FontName','Times');    