# How to plot more paths to this SDE simulation? [duplicate]

I have the following code that simulates an Ito process in Mathematica,

a = .3;
μ = 0.2;
c = .1;
σ = 0.1;
sol = RandomFunction[
ItoProcess[{\[DifferentialD]s[t] == -a s[t] i[
t] \[DifferentialD]t, \[DifferentialD]i[
t] == (a s[t] i[t] - μ i[t] +
c (1 - s[t] - i[t]) i[t]) \[DifferentialD]t + σ i[
t] \[DifferentialD]W[t]}, {s[t], i[t]}, {{s, i}, {0.5, 0.5}},
t, W \[Distributed] WienerProcess[0, 1]], {0, 30, 0.01}];

grafsolesto =
ListLinePlot[sol, PlotStyle -> {Thickness[Medium]}, PlotRange -> All,
PlotTheme -> "Scientific", ImageSize -> Medium,
FrameLabel -> (Style[#, 12, Bold] & /@ {"t", "População"}),
PlotLegends ->
LineLegend[{Orange, {Red, Blue}}, {Style["S(t)", Bold, 12],
Style["I(t)", Bold, 12]}]]


but it yields just one path in my simulation.

What I really want is to simulate several paths and plot them with the mean value and the standard deviation in the same graph.

How could I do this? What I want is something like the following:

Ps: I tried to set the number of paths after the last argument of randomfunction, but it doensn't work.

sol2 = RandomFunction[ItoProcess[{\[DifferentialD]s[t] == -a s[t] i[t] \[DifferentialD]t,
\[DifferentialD]i[t] == (a s[t] i[t] - μ i[t] +
c (1 - s[t] - i[t]) i[t]) \[DifferentialD]t + σ i[t] \[DifferentialD]W[t]},
{s[t], i[t]}, {{s, i}, {0.5, 0.5}},
t, W \[Distributed] WienerProcess[0, 1]], {0, 30, 0.01}, 5];

grafsolesto2 = ListLinePlot[Join @@ (Normal /@ sol2["PathComponents"]),
PlotStyle -> {Thickness[Medium]}, PlotRange -> All,
PlotTheme -> "Scientific", ImageSize -> 500,
FrameLabel -> (Style[#, 12, Bold] & /@ {"t", "População"}),
PlotLegends -> Join[Subscript["S", #][t] & /@ Range[5],
Subscript["I", #][t] & /@ Range[5]]];

mstd = ListLinePlot[Join @@ ({ Mean[#], Mean[#] - 2 StandardDeviation[#],
Mean[#] + StandardDeviation[#]} & /@ Normal /@ sol2["PathComponents"]),
PlotStyle -> {Thickness[Large], Thin, Thin}, PlotRange -> All,
Filling -> {2 -> {3}, 5 -> {6}}];

Show[grafsolesto2, mstd]


• What about the mean (standard deviation) curve? – Herr Schrödinger Jul 18 '18 at 8:16