function Fig_5() x=-50:1:50; % 50 samples per second close all; f2=figure; speed=.92*exp(-(x/15).^2); acc=get_acceleration(x,0,speed)/5; acc0=get_acceleration0(x,0,acc); th=smooth_theta2(acc,1-exp(-.1)); ff=90; fg=.8; subplot(2,3,1) plot(x,[speed*fg; acc*ff*fg*.8; acc*ff]'); set(gca,'YTick',-1:1,'XTick',-100:50:100); axis([-50 50 -1 1]) axis square % hold on; subplot(2,3,2) plot(x,[speed*fg; acc*ff*fg*.8; acc0*ff]'); set(gca,'YTick',-1:1,'XTick',-100:50:100); axis([-50 50 -1 1]) axis square subplot(2,3,3) plot(x,[speed*fg; acc*ff*fg*.8; th*ff]'); set(gca,'YTick',-1:1,'XTick',-100:50:100); axis([-50 50 -1 1]) axis square [corr(speed',acc') corr(acc',acc'); corr(speed',acc0') corr(acc',acc0'); corr(speed',th') corr(acc',th')] function acc=get_acceleration(x,x0,speed) x=x-x0; acc=[0 speed(3:end)-speed(1:end-2) 0]/2; function acc=get_acceleration0(x,x0,acc) acc(acc<0)=0;