each two plots are concatenation of HeavisidePi
The code for the first plot is :
listID1={2,0,9,4,3,9,6,7,8};
tCje[l_]:=Table[l[[n]]*HeavisidePi[x-(n+1)],{n,1,9}];
Plot[tCje[listID1],{x,0,20},Exclusions->None]
EDIT:
Thanks to J.M. for suggesting a much better way of generating the function. This yields the same plot as below:
plt = Differences[ArrayPad[listID1, 1]].UnitStep[x - Range[1 + 1/2, 10 + 1/2]];
Plot[plt, {x, 0, 20}, Exclusions -> None]
ORIGINAL:
If you turn it into a piecewise function, it should work.
pcw = Piecewise[
MapThread[{#1, #2} &, {tCje[listID1],
Join[{x <= 2.5},
Table[i < x <= i + 1, {i, 2.5, 8.5, 1}], {9.5 < x}]}]]
Plot[pcw, {x, 0, 20}, Exclusions -> None]
I make the first and last conditions of the piecewise to be special so that it plots over any range you want.
Differences[ArrayPad[listID1, 1]].UnitStep[x - Range[1 + 1/2, 10 + 1/2]]
.
$\endgroup$
Commented
May 13, 2020 at 0:55
Piecewise[]
version, if that is the preferred format: FullSimplify[Piecewise[Append[Transpose[{listID1, #1 <= x < #2 & @@@ Partition[Range[1 + 1/2, 10 + 1/2], 2, 1]}], {0, True}]] == Differences[ArrayPad[listID1, 1]].UnitStep[x - Range[1 + 1/2, 10 + 1/2]], x ∈ Reals]
$\endgroup$
Commented
May 13, 2020 at 9:38
Using ListStepPlot
:
listID1 = {2, 0, 9, 4, 3, 9, 6, 7, 8};
data = Join[{0}, listID1]
ListStepPlot[data, "Center"]
HeavisidePi
is a distribution ("HeavisidePi[x]
is equivalent toHeavisideTheta[-x2]
"), not a function. In view of it, any plot is misleading here. $\endgroup$