Distr_pendubot(M, S, l, l);
    error_ellipse(S1, M1, 'style','b'); % inner pendulum
    error_ellipse(S2, M2, 'style','r'); % outer pendulum
  end
catch
end

% Draw useful information
% plot applied torque
plot([0 force/umax*xmax],[-0.5, -0.5],'g','linewidth',10)
% plot immediate reward
reward = 1-cost.fcn(cost,[0, 0, theta1, theta2]',zeros(4));
plot([0 reward*xmax],[-0.7, -0.7],'y','linewidth',10)
text(0,-0.5,'applied  torque (inner joint)')
text(0,-0.7,'immediate reward')
if exist('text1','var')  
  text