The correct way of compute indicator function in Mathematica

k = 4;
xx = BlockMap[Boole[# <= t <= #2] & @@ # &, #, 2, 1] & /@ Subdivide /@ Range[k];

Column[Plot[#, {t, 0, 1}, Filling -> Axis, Frame -> True, 
    ImageSize -> 1 -> 300, AspectRatio -> 1/5, PlotTheme -> "Minimal"] & /@ xx]

enter image description here


kglr gives the general solution using Iverson brackets (Boole[] in Mathematica), which are entirely equivalent to the indicator function. Alternatively, one could also use the UnitBox[] function. Using kglr's example:

With[{m = 6}, 
     Column[Plot[#, {t, 0, 1}, AspectRatio -> 1/5, Filling -> Axis, Frame -> True,
                 ImageSize -> 1 -> 300, PlotRange -> {0, 1}, PlotTheme -> "Minimal"] & /@ 
            Table[UnitBox[k t - j - 1/2], {k, m}, {j, 0, k - 1}]]]

indicator functions

Another function equivalent to UnitBox[k t - j - 1/2] is BSplineBasis[0, 0, k t - j].