convones
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | convones [2010/06/22 03:10] (current) – created jochen | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== convones ====== | ||
+ | ===== Motivation ===== | ||
+ | The main motivation to use convones is to have a faster routine for the special case where one of the arguments of a one-dimensional convolution is a series of all-1 values. | ||
+ | |||
+ | ===== Reference ===== | ||
+ | < | ||
+ | |||
+ | FORMAT: | ||
+ | |||
+ | Input fields: | ||
+ | |||
+ | f | ||
+ | cnum number of consecutive ones to use | ||
+ | w if 1x1 true, weight (divide by number of samples) | ||
+ | |||
+ | Output fields: | ||
+ | |||
+ | cfunc | ||
+ | |||
+ | See also conv</ | ||
+ | |||
+ | ===== Used by ===== | ||
+ | The main internal use for this function is the creation of design matrices. Opposed to SPM (which typically uses a 16 timebin-per-TR resolution), | ||
+ | |||
+ | ===== Exemplary use ===== | ||
+ | <code matlab conv_ones_rectwindow.m> | ||
+ | k = smoothkern(2000); | ||
+ | |||
+ | % convolve with a all-ones vector of equal length | ||
+ | tic, ko = convones(k, numel(k)); toc | ||
+ | % reference: Elapsed time is 0.024565 seconds. | ||
+ | |||
+ | % and now the same with conv | ||
+ | tic, koc = conv(k, ones(numel(k), | ||
+ | % reference: Elapsed time is 0.240042 seconds.</ | ||
+ | |||
+ | Note: the difference gets larger the longer the vectors become!! |
convones.txt · Last modified: 2010/06/22 03:10 by jochen