⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hrf.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function [h, s] = hrf(shape, sfrq, pttp, nttp, pnr, ons, pdsp, ndsp)
% hrf  - create canonical HRF shape
%
% FORMAT:       [h, s] = hrf(shape, sfrq, pttp, nttp, pnr, ons, pdsp, ndsp)
%
% Input fields:
%
%       shape       HRF general shape {'twogamma' [, 'boynton']}
%       sfrq        HRF sample frequency (default: 1s/16, OK: [1e-3 .. 5])
%       pttp        time to positive (response) peak (default: 5 secs)
%       nttp        time to negative (undershoot) peak (default: 15 secs)
%       pnr         pos-to-neg ratio (default: 6, OK: [1 .. Inf])
%       ons         onset of the HRF (default: 0 secs, OK: [-5 .. 5])
%       pdsp        dispersion of positive gamma PDF (default: 1)
%       ndsp        dispersion of negative gamma PDF (default: 1)
%
% Output fields:
%
%       h           HRF function given within [0 .. onset + 2*nttp]
%       s           HRF sample points
%
% Note: the pttp and nttp parameters are increased by 1 before given
%       as parameters into the gammapdf function (which is a property
%       of the gamma PDF!)
%
% See also gammapdf

% Version:  v0.6b
% Build:    7010811
% Date:     Jan-08 2007, 11:35 AM CET
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 8 || ...
   ~isa(ndsp, 'double') || ...
    numel(ndsp) ~= 1 || ...
    isinf(ndsp) || ...
    isnan(ndsp) || ...
    ndsp <= 0
    ndsp = 1;
end
if nargin < 7 || ...
   ~isa(pdsp, 'double') || ...
    numel(pdsp) ~= 1 || ...
    isinf(pdsp) || ...
    isnan(pdsp) || ...
    pdsp <= 0
    pdsp = 1;
end
if nargin < 6 || ...
   ~isa(ons, 'double') || ...
    numel(ons) ~= 1 || ...
    isinf(ons) || ...
    isnan(ons) || ...
    ons < -5 || ...
    ons > 5
    ons = 0;
end
if nargin < 5 || ...
   ~isa(pnr, 'double') || ...
    numel(pnr) ~= 1 || ...
    isnan(pnr) || ...
    pnr < 1
    pnr = 6;
end
if nargin < 4 || ...
   ~isa(nttp, 'double') || ...
    numel(nttp) ~= 1 || ...
    isinf(nttp) || ...
    isnan(nttp) || ...
    nttp < 1 || ...
    nttp > 30
    nttp = 15;
end
if nargin < 3 || ...
   ~isa(pttp, 'double') || ...
    numel(pttp) ~= 1 || ...
    isinf(pttp) || ...
    isnan(pttp) || ...
    pttp < 1 || ...
    pttp > 30
    pttp = 5;
end
if nargin < 2 || ...
   ~isa(sfrq, 'double') || ...
    numel(sfrq) ~= 1 || ...
    isinf(sfrq) || ...
    isnan(sfrq) || ...
    sfrq > 5
    sfrq = 1/16;
elseif sfrq < 0.001
    sfrq = 0.001;
end
if nargin < 1 || ...
   ~ischar(shape) || ...
   ~any(strcmpi(shape, {'twogamma', 'boynton'}))
    shape = 'twogamma';
else
    shape = lower(shape(:)');
end

% computation (according to shape)
s = (0:sfrq:(ons + 2*nttp)) - ons;
switch (shape)

    % boynton (single-gamma) HRF
    case {'boynton'}
        h = gammapdf(s, pttp + 1, pdsp);
        
    % two-gamma HRF
    case {'twogamma'}
        h = gammapdf(s, pttp + 1, pdsp) - gammapdf(s, nttp + 1, ndsp) / pnr;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -