Error in FREQANALYSIS

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Thu Mar 15 13:53:46 CET 2007


Hi Grant

On 14 Mar 2007, at 22:12, Christian Hesse wrote:
> Ahhh ... you're trying to do all of this without the signal
> processing toolbox, aren't you. In that case I must apologize for
> having given you slightly inaccurate info before: the DPSS and
> WINDOW functions are from the signal processing toolbox.
>
> ...
> Realistically speaking though, it seems to me that your best
> options are basically a) to get the signal processing toolbox, or
> b)  to just write your own matlab functions to estimate your power
> spectra (about 3 lines of code) and then calculate your SEF and MF
> measures (another few lines at most).

with respect to option "b": I think the easiest is to replicate the
WINDOW function from the signal preocessing toolbox. The dpss is
difficult, but hanning, triangle, rectwin and some others are
trivial. The WINDOW function is just a convenient wrapper function
for various tapers. See at the bottom of this mail for the full help.
The window replacement function to be written should behave as

 >> tap = window('hanning', 10)
tap =
     0.0794
     0.2923
     0.5712
     0.8274
     0.9797
     0.9797
     0.8274
     0.5712
     0.2923
     0.0794

 >> tap = window('rectwin', 10)
tap =
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1

 >> tap = window('triang', 10)
tap =
     0.1000
     0.3000
     0.5000
     0.7000
     0.9000
     0.9000
     0.7000
     0.5000
     0.3000
     0.1000

I hope that this suggestion helps,
Robert


---------------

 >> help window
WINDOW Window function gateway.
     WINDOW(@WNAME,N) returns an N-point window of type specified
     by the function handle @WNAME in a column vector.  @WNAME can
     be any valid window function name, for example:
     @bartlett       - Bartlett window.
     @barthannwin    - Modified Bartlett-Hanning window.
     @blackman       - Blackman window.
     @blackmanharris - Minimum 4-term Blackman-Harris window.
     @bohmanwin      - Bohman window.
     @chebwin        - Chebyshev window.
     @flattopwin     - Flat Top window.
     @gausswin       - Gaussian window.
     @hamming        - Hamming window.
     @hann           - Hann window.
     @kaiser         - Kaiser window.
     @nuttallwin     - Nuttall defined minimum 4-term Blackman-Harris
window.
     @parzenwin      - Parzen (de la Valle-Poussin) window.
     @rectwin        - Rectangular window.
     @tukeywin       - Tukey window.
     @triang         - Triangular window.
     WINDOW(@WNAME,N,OPT) designs the window with the optional input
argument
     specified in OPT. To see what the optional input arguments are,
see the help
     for the individual windows, for example, KAISER or CHEBWIN.
     WINDOW launches the Window Design & Analysis Tool (WinTool).
     EXAMPLE:
        N  = 65;
        w  = window(@blackmanharris,N);
        w1 = window(@hamming,N);
        w2 = window(@gausswin,N,2.5);
        plot(1:N,[w,w1,w2]); axis([1 N 0 1]);
        legend('Blackman-Harris','Hamming','Gaussian');

     See also bartlett, barthannwin, blackman, blackmanharris,
bohmanwin,
              chebwin, gausswin, hamming, hann, kaiser, nuttallwin,
parzenwin,
              rectwin, triang, tukeywin, WINTOOL.



More information about the fieldtrip mailing list