Fig_6.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. load('data_fig_6.db','-mat');
  2. close all;
  3. %%
  4. f=figure;
  5. subplot(2,1,1)
  6. sel=1:numel(data.v);
  7. speeds=data.v(sel)';
  8. accs=[0 speeds(3:end)-speeds(1:end-2) 0]/.04;
  9. ths=smooth_theta2(accs,1-exp(-.1));
  10. raccs=accs;
  11. raccs(raccs<0)=0;
  12. plot(sel/50,(speeds)/std(speeds),'r');
  13. hold on;
  14. plot(sel/50,accs/std(accs),'b');
  15. plot(sel/50,ths/std(accs),'g');
  16. xlim([0 10])
  17. ths=8+ths/100;
  18. da=20; abins=-5:5;
  19. dv=5; vbins=0:12;
  20. rv=round(speeds/dv);
  21. ra=round(accs/da);
  22. vfr=arrayfun(@(x) mean(ths(rv==x)),vbins);
  23. afr=arrayfun(@(x) mean(ths(ra==x)),abins);
  24. m8=vfr(1);
  25. [th_f5,th_s5]=mybp(ths-m8,0.5);
  26. [th_f1,th_s1]=mybp(ths-m8,0.1);
  27. [th_f3,th_s3]=mybp(ths-m8,0.3);
  28. vfr_f=arrayfun(@(x) mean(th_f5(rv==x))+m8,vbins);
  29. vfr_s=arrayfun(@(x) mean(th_s5(rv==x))+m8,vbins);
  30. afr_f=arrayfun(@(x) mean(th_f1(ra==x))+m8,abins);
  31. afr_s=arrayfun(@(x) mean(th_s1(ra==x))+m8,abins);
  32. subplot(2,2,3)
  33. plot(vbins*dv,[vfr; vfr_s; vfr_f]');
  34. axis([0 50 7.8 9.1])
  35. golden(2.5)
  36. subplot(2,2,4)
  37. plot(abins*da,[afr; afr_s; afr_f]');
  38. axis([-120 140 7.8 9.1])
  39. set(gca,'YTick',6:.5:12);
  40. [corr(speeds',ths') corr(accs',ths');
  41. corr(speeds',th_f5') corr(accs',th_f1');
  42. corr(speeds',th_s5') corr(accs',th_s1')]
  43. drawnow;
  44. function [th_f,th_s]=mybp(ths,f1)
  45. th_f=real(bandpass_and_hilbert(ths',f1,100,50)');
  46. th_s=real(bandpass_and_hilbert(ths',0,f1,50)');
  47. end