calculus and analysis – Plotting function and its approximation function

I have a problem which I have not been able to solve. I want to plot a function and and operator which approximates it when you let w to infinity. I will give all needed information for MWE and my faults.

MathJax

$$
operatorname{Fejer}(x):= dfrac{1}{2} operatorname{sinc}^2left(dfrac{x}{2}right) quad (xin mathbb{R})\
operatorname{sinc} x:=
begin{cases}
dfrac{sin pi x}{pi x}, & xin mathbb{R} backslash {0}\
1, & x=0
end{cases}\
operatorname{Function}(x):=begin{cases}
dfrac{9}{x^2},& x<3\
2,& -3<x<-2\
-dfrac{1}{2},& -2<x<-1\
dfrac{3}{2}, & -1<x<0\
1,& 0<x<1\
-1,& 1<x<2\
0,& 2<x<3\
-dfrac{50}{x^4},& 3<x\
end{cases}
$$

Code

sinc(x_) := Piecewise({{1, Equal(x, 0)}, {Sin(Pi x)/(Pi x), True}})
Fejer(x_) := 1/2*sinc(x/2)^2
function(x_) := 
  Piecewise(
    {{9/(x^2), x < -3}, 
     {2, -3 <= x < -2}, 
     {-1/2, -2 <= x < -1}, 
     {3/2, -1 <= x < 0}, 
     {1, 0 <= x < 1}, 
     {-1, 1 <= x < 2}, 
     {0, 2 <= x < 3}, 
     {-50/(x^4), 3 <= x}})
constant(x_) := 1

With above code I am defining the functions which I gave mathematically above to make it easier for you. Now, I’m trying to define my operator.

operator(w_, kernel_, func_, x_) := 
  Sum(
    w *
      Integrate(func(u), {u, k/w, (k + 1)/w}, Assumptions -> k ∈ Integers) *
      kernel(w*x - k), 
    {k, -Infinity, Infinity})

I’m not sure about the above code. I used Assumption in the integral because I was getting errors like “integral limits may not reals, please add assumption”. I also show it in MathJax so you can understand what I’m trying to do.

Operator

$$ (S_wf)(x):=sum_{kin mathbb{Z}} chi(wx-k) wint_{k/w}^{(k+1)/w} f(u)du , quad xin mathbb{R}, , w>0$$

When you take function to br $1$ for every $xin mathbb{R}$, operator gives $1$. Anyway when I running code

operator(w, Fejer, constant, x) 

or

operator(5, Fejer, constant, x) 

it gives nothing. When I tried plot

Plot(Operator(5, Fejer, cons, x), {x, 0, 5})

it quits the kernel without an error.

When I tried

Plot(Operator(5, Fejer, function, x), {x, 0, 5})

It gives many errors and some of them are:

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

NIntegrate::nlim: u = 0.2 k is not a valid limit of integration.

General::stop: Further output of NIntegrate::nlim will be suppressed during this calculation.

Finally, I’m adding a result which I’m trying to reach.

enter image description here