Fig_5.m 891 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. function Fig_5()
  2. x=-50:1:50; % 50 samples per second
  3. close all;
  4. f2=figure;
  5. speed=.92*exp(-(x/15).^2);
  6. acc=get_acceleration(x,0,speed)/5;
  7. acc0=get_acceleration0(x,0,acc);
  8. th=smooth_theta2(acc,1-exp(-.1));
  9. ff=90; fg=.8;
  10. subplot(2,3,1)
  11. plot(x,[speed*fg; acc*ff*fg*.8; acc*ff]');
  12. set(gca,'YTick',-1:1,'XTick',-100:50:100);
  13. axis([-50 50 -1 1])
  14. axis square
  15. % hold on;
  16. subplot(2,3,2)
  17. plot(x,[speed*fg; acc*ff*fg*.8; acc0*ff]');
  18. set(gca,'YTick',-1:1,'XTick',-100:50:100);
  19. axis([-50 50 -1 1])
  20. axis square
  21. subplot(2,3,3)
  22. plot(x,[speed*fg; acc*ff*fg*.8; th*ff]');
  23. set(gca,'YTick',-1:1,'XTick',-100:50:100);
  24. axis([-50 50 -1 1])
  25. axis square
  26. [corr(speed',acc') corr(acc',acc');
  27. corr(speed',acc0') corr(acc',acc0');
  28. corr(speed',th') corr(acc',th')]
  29. function acc=get_acceleration(x,x0,speed)
  30. x=x-x0;
  31. acc=[0 speed(3:end)-speed(1:end-2) 0]/2;
  32. function acc=get_acceleration0(x,x0,acc)
  33. acc(acc<0)=0;