ame="2"></a></h2><pre class="codeinput"><span class="comment">% 1. Initialization</span>
clear <span class="string">all</span>; close <span class="string">all</span>;
settings_pendubot;            <span class="comment">% load scenario-specific settings</span>
basename = <span class="string">'pendubot_'</span>;       <span class="comment">% filename used for saving data</span>

<span class="comment">% 2. Initial J random rollouts</span>
<span class="keyword">for</span> jj = 1:J
  [xx, yy, realCost{jj}, laten