I have the following code in Mathematica using the Finite difference method to solve for c1(t), where . However, I am having trouble writing the sum series in Matlab. The attatched image shows how the plot of real(c(t) should look like.

`\[CapitalOmega] = 0.3;\[Alpha][\[Tau]] := Exp[I \[CapitalOmega] \[Tau]] ;dt = 0.1;Ns = 1000;ds = dt/Ns;Ttab = Table[T, {T, 0, 10, dt}];Stab = Table[s, {s, 0, dt - ds, ds}];c[0] = 1;Do[corrSum[n] = Sum[c[nn - 1]*Sum[\[Alpha][n dt - m ds]*ds, {m, Ns (nn - 1), Ns nn , 1}], {nn, 1, n}]; c[n] = c[n - 1] - dt*corrSum[n](*c[n-1]*\[Alpha][n dt]*), {n, 1, 100}]cTtab = Table[{n*dt, c[n]}, {n, 0, 100}]FDiff = ListPlot[Re[cTtab], PlotStyle -> Orange, PlotLegends -> {"Finite Difference"}]`

## Best Answer