Clear[s, im1, im2, im3, im4, f]
s[x_] := 
      If[1 ≤ x ≤ 3, 1, 0]
im1[x_] := 
      If[-3 ≤ x ≤ -1, -1, 
        0]
im2[x_] := 
      If[9 ≤ x ≤ 11, -1, 
        0]
im3[x_] := 
      If[-11 ≤ x ≤ -9, 1, 
        0]
im4[x_] := 
      If[13 ≤ x ≤ 15, 1, 0]
f[x_] := (1/2) (s[x + t] + s[x - t] + im1[x + t] + im1[x - t] + 
            im2[x + t] + im2[x - t] + im3[x + t] + im3[x - t] + im4[x + t] + 
            im4[x - t])
Table[
      Plot[f[x], {x, -20, 20}, 
        PlotRange -> {{0, 6}, {-1.1, 1.1}}, 
        AxesLabel -> {"x", "u(x,t)"}, 
        PlotStyle -> {RGBColor[1, 0.6, 0], Thickness[0.015]}], {t, 0, 
        12, 0.1}]