I have a simscape multi body simulation that I simulate using Fast Restart and optimize with fmincon. Each simulation of roughly 4 seconds simulation time takes about 0.3 seconds to run. I want to do something called "multiple shooting" where I chop up that 4 seconds into about 20 segments of 0.2 seconds of simulation time each to do trajectory optimization. However when I do so, each of these segments still takes about 0.3 seconds of real time to run making the whole 4 seconds of simulation time take 6 seconds or real time, rather than 0.3 seconds. This is a very meaningful change to me because fmincon will perform these simulations thousands of times. Do you have a suggestion of how I can speed this up? One more detail - I need to change some parameters between each 0.2 second simulation. Thanks!