The result of the integration should be
g = -cos(x) + A
where A is the integration constant. Since cumtrapz() is the cumulative trapezoidal numerical integration, the boundary condition is set to
g(0) = 0
resulting in
A = 1
Kind regards,
Robert

Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!