1
$\begingroup$

My Show expression showing four curves will not display the all four curves over the full domain requested in the PlotRange option.

Image and code below:

Equation, Plot, and Code

ClearAll[Ts, T]
FullSimplify[1/(5 s + 1)/(1 + Kc/(5 s + 1))]

Ts[Kc_, s_] := 1/(Kc + 1 + 5 s) 10/s;
T[Kc_, t_] := InverseLaplaceTransform[Ts[Kc, s], s, t]
T[Kc, t]

t0 = 30;

Show[
  Plot[T[0.1, t], {t, 0, t0}, PlotStyle -> Red, PlotLegends -> "Kc=0.1"],
  Plot[T[1, t], {t, 0, t0}, PlotStyle -> Blue, PlotLegends -> "Kc=1"],
  Plot[T[2, t], {t, 0, t0}, PlotStyle -> Green, PlotLegends -> "Kc=2"],
  Plot[T[10, t], {t, 0, t0}, PlotStyle -> Orange, PlotLegends -> "Kc=10"],
  PlotRange -> {{0, 30}, {0, 10}}]

T[0.1, 2]
N[T[1, 2]]
N[T[2, 2]]
N[T[10, 2]]

I evaluated T at points not shown on the plot to make sure the it is continuous there.

Side note: I cannot get my legend to display color keys (even when using LineLegends. Less important than my main issue, but any help with that would be great.

$\endgroup$

closed as off-topic by march, Bob Hanlon, bbgodfrey, MarcoB, Henrik Schumacher Mar 2 at 20:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – march, Bob Hanlon, bbgodfrey, MarcoB, Henrik Schumacher
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Adding , PlotRange -> All to each call to Plot also works. $\endgroup$ – bbgodfrey Mar 2 at 1:52
3
$\begingroup$

Use a single Plot command instead of using Show to combine multiple plots:

Plot[
    {T[.1,t],T[1,t],T[2,t],T[10,t]},
    {t,0,10},
    PlotLegends->{"Kc=0.1","Kc=1","Kc=2","Kc=10"}
]

enter image description here

$\endgroup$
  • $\begingroup$ An elegant and effective solution, thanks for helping me improve! $\endgroup$ – ASP Mar 1 at 23:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.