Problem with TransformedDistribution
You get what you expect if you do it it in two steps
\[ScriptCapitalD] =
TransformedDistribution[x/2,
x \[Distributed] TransformedDistribution[(A + B), {
B \[Distributed] UniformDistribution[{L, H}],
A \[Distributed] UniformDistribution[{L, H}]}]]
(* TriangularDistribution[{L, H}] *)
PDF[\[ScriptCapitalD]][z]
(((-30 + z)Sign[-30 + z])/2 - (-20 + z) Sign[-20 + z] + ((-10 + z)*Sign[-10 + z])/2)/100
For plotting, assign values to L
and H
:
L = 10; H = 30;
Plot[Evaluate@PDF[\[ScriptCapitalD]][x], {x, 10, 30}]
pdF[l_, h_] := Module[{L = l, H = h}, Evaluate[PDF[\[ScriptCapitalD]]]]
Plot[Evaluate @ Flatten@Table[pdF[l, h][x], {l, {0, 5}}, {h, {10, 15}}], {x, 0, 15},
PlotRange -> All,
PlotLegends -> (Flatten @ Table[ToString@{l, h}, {l, {0, 5}}, {h, {10, 15}}])]