- converted your script to a function, cssm [attached]
- pre-allocated a couple of vectors, time and N, to improve speed
- alwaysontop and hold on
- run the function for some different input values. (I used a smaller time step.)

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