Hello! I need to average on many runs of the function NDsolve - each one with different initial conditions. I store each run in the variable:
solList = Table[1, {j, 2}, {i, DtNum}];
I am running a Do loop as follows:
Do[
s = NDSolve[{cg'[t] == I \[CapitalOmega] ce[t],
ce'[t] == I \[CapitalOmega] cg[t], ce[DeltaT*(n - 1)] == 0,
cg[DeltaT*(n - 1)] == 1}, {cg[t], ce[t]}, {t, DeltaT*(n - 1),
DeltaT*n},
"ExtrapolationHandler" -> {Indeterminate &,
"WarningMessage" -> False}];
sols = {cg[t], ce[t]} = {cg[t], ce[t]} /. s[[1]];
solList[[1]][[n]] = sols[[1]]+solList[[1]][[n]] ;
solList[[2]][[n]] = sols[[2]]+solList[[2]][[n]] ;
,{n, Tmax}]
In the end I want to plot the value in, for example: solList[[1]][[10]] - hoping that it will be the sum of all the functions that were calculated in the Do loop. It seems not to work and I don't know why. Any help will be greatly appreciated!