% tip of pendulum
plot(l*sin(theta),-l*cos(theta),'k.','markersize',24)
plot(l*sin(theta),-l*cos(theta),'y.','markersize',14)
plot(0,-2*l,'.w','markersize',0.005)
% applied torque
plot([0 torque/umax*xmax],[-0.5, -0.5],'g','linewidth',10);
% immediate reward
reward = 1-cost.fcn(cost,[0, theta]',zeros(2));
plot([0 reward*xmax],[-0.7, -0.7],'y', 'linewidth',10);
text(0,-0.5,'applied  torque')
text(0,-0.7,'immediate reward')
if exist('text1','var')  
  text(0,-0.9, text1)
end
if exist('text2','var')  
  text(0