f[k_, x_]  :=  Exp[-x^2/2] (1 - x^2)

Plot[f[6, x], {x, -4, 4}]

c[f_, m_Integer, n_Integer]  :=  
      (2^(-m/2)) 
        (Integrate[f[x], {x, n 2^m, (n  +  1/2) 2^m}]  -  
            Integrate[f[x], {x, 2^m (n + 1/2), 2^m (n + 1)}])

phi[x_]  :=  
      Which[0 <=  x  &&  x < 1/2, 1, 1/2 <= x  &&  x < 1, -1, 
        x < 0  ||  x >= 1, 0]

phi[m_Integer, n_Integer, x_]  :=  
      2^(-m/2) phi[x/(2^m)  -  n]

approx[f_, m_, n_, x_]  :=  
      Sum[c[f, i, j] phi[i, j, x], {i, 0, m}, {j, 0, n}]

approx[Sin, 5, 5, x]

plot1  =  
      Plot[%, {x, 0, 2  π}, PlotStyle -> {RGBColor[1, 0, 0]}]

plot2  =  
      Plot[Sin[x], {x, 0, 2  π}, PlotStyle -> {RGBColor[0, 0, 1]}]

Show[plot1, plot2]