I need to solve the n ODE and create a function which is a sum of all the solutions. I wanted to use the code below, but only part (solve) and (create solution) works well. How can I store the solutions from each ODE and add them together to obtain one function ? Thank you for any help
sxf={}; (* list for solutions of each ODE *)
For [i = 1; i < 10, i++;
xusol = DSolve[{dx[[i]] == a[[i]], x0ui[[i]] == x0u[[i]]}, x[[i]], t] (*solve*)
sx[t_]:= Evaluate[x[[i]] /. xusol]; (* create solution ??? *)
AppendTo[xlist,sx]; (* store *)]
sxf = Function[t, Sum[sx,{i, 1, Ns}]]; (* sum all solutions ??? *)
Plot[sxf[t], {t, 0, tmax}] (* plot x[t] *)
Comments
Post a Comment