% Runs the model absbrake model and plots graphs

absbrake
% Run simulation until vehicle stops
t=rk45('absbrake',25,[],[0.001 0.0001 0.01]);

set(0,'defaultaxesfontsize',8)

h=figure('pos',[298   292   452   257]);
plot(time,yout)
title ('Vehicle speed and wheel speed')
ylabel('Speed(rad/sec)')
xlabel('Time(secs)')
set(gca,'pos',[0.1300    0.1500    0.7750    0.750])
set(get(gca,'xlabel'),'fontsize',10)
set(get(gca,'ylabel'),'fontsize',10)
set(get(gca,'title'),'fontsize',10)

% Plot arrow with annotation
hold on
plot([5.958; 4.192],[36.92; 17.29],'r-',[5.758; 5.958; 6.029],[36.55; 36.92; 35.86],'r-' )
text(8.533,54.66,'Vehicle speed (Wv)','fontsize',10)
plot([7.14; 8.35],[43.1; 56.3],'r-',[7.34; 7.14; 7.07],[43.4; 43.1; 44.1],'r-' )
text(4.342,15.69,'Wheel speed (Ww)','fontsize',10)
drawnow

h=figure('pos',[297     6   455   242]);
plot(time,slp)
title ('Slip')
xlabel('Time(secs)')
set(gca,'pos',[0.1300    0.1500    0.7750    0.750])
set(get(gca,'xlabel'),'fontsize',10)
set(get(gca,'ylabel'),'fontsize',10)
set(get(gca,'title'),'fontsize',10)

