genDurSeq.m 585 B

1234567891011121314151617181920212223
  1. function [w1, w2] = genDurSeq(nTrl, plotSign)
  2. % first generate the random walk sequence
  3. w1 = cumsum(randn(1, nTrl));
  4. w1 = (w1 - mean(w1))/std(w1); % normalize
  5. % appr. scale to 0.5 to 2
  6. w1 = w1/(max(w1)-min(w1))*1.6 + 1;
  7. % discretize to 100 ms
  8. w1 = round(w1*10)/10;
  9. % another sequence with randomization
  10. w2 = w1(randperm( length(w1) ) );
  11. if plotSign == 1
  12. figure(); hold on; subplot(2,2,1);plot(w1)
  13. subplot(2,2,2);hist(w1);
  14. subplot(2,2,3);plot(w2)
  15. subplot(2,2,4);hist(w2);
  16. end
  17. %
  18. %estHighHurst = estimate_hurst_exponent(w1)
  19. %estLowHurst = estimate_hurst_exponent(w2)