bpvec.m 862 B

123456789101112131415161718192021222324252627282930
  1. function y = bpvec(f,s,Fs,width)
  2. % function y = bpvec(f,s,Fs,width)
  3. %
  4. % Returns a vector 'y' containing signal 's' filtered for frequency 'f'
  5. % (via convolution with a complex Morlet wavelet described by 'width')
  6. %
  7. % INPUTS:
  8. % f - frequency to filter at
  9. % s - signal to be filtered
  10. % Fs - sampling frequency of s
  11. % width - parameter which defines the mother wavelet (this is then
  12. % scaled and translated in order to filter for different frequencies,
  13. % >= 5 is suggested, see Tallon-Baudry et al., J. Neurosci. 15, 722-734
  14. % (1997))
  15. %
  16. % NOTE: This function is a modification of code written Ole Jensen, August
  17. % 1998, see ENERGYVEC
  18. %
  19. % Author: Angela Onslow, May 2010
  20. dt = 1/Fs;
  21. sf = f/width;
  22. st = 1/(2*pi*sf);
  23. t=-(width/2)*st:dt:(width/2)*st;
  24. m = morlet_wav(f,t,width);
  25. y = conv(s,m);
  26. y = real(y);
  27. y = y(ceil(length(m)/2):length(y)-floor(length(m)/2));