Doxygen Source Code Documentation
spm_hrf.m
Go to the documentation of this file.00001 function [hrf,p] = spm_hrf(RT,P);
00002 % returns a hemodynamic response function
00003 % FORMAT [hrf,p] = spm_hrf(RT,[p]);
00004 % RT - scan repeat time
00005 % p - parameters of the response function (two gamma functions)
00006 %
00007 % defaults
00008 % (seconds)
00009 % p(1) - delay of response (relative to onset) 6
00010 % p(2) - delay of undershoot (relative to onset) 16
00011 % p(3) - dispersion of response 1
00012 % p(4) - dispersion of undershoot 1
00013 % p(5) - ratio of response to undershoot 6
00014 % p(6) - onset (seconds) 0
00015 % p(7) - length of kernel (seconds) 32
00016 %
00017 % hrf - hemodynamic response function
00018 % p - parameters of the response function
00019 %_______________________________________________________________________
00020 % @(#)spm_hrf.m 2.8 Karl Friston 02/07/31
00021
00022 % global parameter
00023 %-----------------------------------------------------------------------
00024 global defaults
00025 if ~isempty(defaults),
00026 fMRI_T = defaults.stats.fmri.t;
00027 else,
00028 fMRI_T = 16;
00029 end;
00030
00031 % default parameters
00032 %-----------------------------------------------------------------------
00033 p = [6 16 1 1 6 0 32];
00034 if nargin > 1
00035 p(1:length(P)) = P;
00036 end
00037
00038 % modelled hemodynamic response function - {mixture of Gammas}
00039 %-----------------------------------------------------------------------
00040 dt = RT/fMRI_T;
00041 u = [0:(p(7)/dt)] - p(6)/dt;
00042 hrf = spm_Gpdf(u,p(1)/p(3),dt/p(3)) - spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5);
00043 hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1);
00044 hrf = hrf'/sum(hrf);