With the following code I am trying to get a plot for the derivative of the ftot1 function, which is a piecewise discontinuous function defined as the sum of other two piecewise discontinuous functions (fd and fo), but I receive an error and a blank plot.
td = 2; to = 2; T = 10; sld = 1; slo = 1;
fd[tstar_, x_ ] :=
If[tstar < td, 0,
Piecewise[{{0, 0 <= x < td}, {sld*x, td <= x < tstar} , {sld*tstar,
tstar <= x <= T}}]];
fo[tstar_ , x_] :=
If[T - tstar < to, 0,
Piecewise[{{0, 0 <= x < tstar + to}, {slo*(x - tstar),
tstar + to <= x <= T}}]];
ftot1[tstar_, x_] = fd[tstar, x] + fo[tstar , x];
Plot[ftot1[tstar, x] /. x -> T, {tstar, 0, T},
Exclusions -> {tstar == td, tstar == T - to},
ExclusionsStyle -> Directive[Red, Dashed]];
D[PiecewiseExpand[ftot1[tstar, x] /. x -> T], tstar]
Limit[D[PiecewiseExpand[ftot1[tstar, x] /. x -> T], tstar],
tstar -> td]
Limit[D[PiecewiseExpand[ftot1[tstar, x] /. x -> T], tstar],
tstar -> to]
Limit[D[PiecewiseExpand[ftot1[tstar, x] /. x -> T], tstar], tstar -> T]
Plot[D[ftot1[tstar, x] /. x -> T, tstar], {tstar, 0, T},
Exclusions -> {tstar == td, tstar == T - to},
ExclusionsStyle -> Directive[Red, Dashed]]
I am trying to deal with the discontinuity points, which are responsible for the failure of the Plot function I think. I have three discontinuity points (at td, to and T). I have tried to play with the range of the discontinuities (changing the equality sign) but nothing changes.
Evaluate
.Plot[D[ftot1[tstar, x] /. x -> T, tstar] // Evaluate, {tstar, 0, T}, Exclusions -> {tstar == td, tstar == T - to}, ExclusionsStyle -> Directive[Red, Dashed]]
$\endgroup$