Dear Darren,
> About a month ago Christian responded to several questions about jittering
> the onset of trials. He said that trials were randomly jittered within 1 TR
> using the Matlab rand() function. I want to run through the practical steps
> and see if I have the correct ideas. Let's say I have 20 trials
>
> 1) Generate random numbers spanning interval {0 1}
> a = rand(20,1);
>
> 2) Shift with respect to 0 so that numbers are distributed from {-.5 .5}
> a= a-.5;
> 3) Now here is the question. The sum(a) should be 0, I think, so that at
> the end of the whole run one ends up evenly. That is if we assume a nominal
> inter trial interval of 16 seconds we are jittering by +/- .5*TR. So if we
> have 20 trials the total time should still equal 20*16. Is this correct?
If you mean correct a: a = a - mean(a), you will end up with the same no
of scans.
Try this:
ISI_TR = 4; % mean intertrial ineterval in TRs
ntrials = 16;
TR = 4000; % TR in ms
base = TR*ISI_TR;
base_v = repmat(base,1,ntrials);
a = rand(size(base_v));
a = a - mean(a); % Gives a total of ISI_TR*ntrials scans
rand_v = TR*a;
times = base_v+rand_v;
hist(times);sum(times)/TR %Check distribution and see total no of scans.
-Christian
--
Dr. C. Buechel
Research Fellow
Functional Imaging Laboratory
Wellcome Dept. of Cognitive Neurology
12 Queen Square
WC1N 3BG London
UK
Tel.: +44-171-833-7483
Fax.: +44-171-813-1420
email: [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|