Next: Using the rCBF Up: Annotated Program Listings Previous: FINDINTCONVO

B_CURVE

  1. Check for the correct number of fitting parameters. We don't want to be very strict about checking input arguments here since this function gets called many times during curve fitting.
    
    if (length(args) ~= 3), error ('Wrong number of fit parameters'), end;

  2. Do a straight forward evaluation of the function.
    
    % N.B.: alpha = args(1)
    %        beta = args(2)
    %       gamma = args(3)
    
    expthing = exp(-args(2)*ts_even); 	% ts_even for the convolution
    c = nconv(shifted_g_even,expthing,ts_even(2)-ts_even(1));
    c = c (1:length(ts_even));		% chop off points outside of the time
    					% domain we're interested in
    
    % Calculate the two main terms of the expression, alpha * (convoluted
    % stuff) and gamma * (shifted activity), and sum them.
    
    i1 = args(1)*c;				% alpha * (convolution)
    i2 = args(3)*shifted_g_even;		% gamma * g(t - delta)
    
    i = i1+i2;
    
    integral = nframeint (ts_even, i, fstart, flengths);

  3. Clean up any NaN's that have cropped up by setting them to zero. Also, truncate the function to whatever length A is.
    
    nuke = find (isnan (integral));
    integral (nuke) = zeros (size (nuke));
    
    integral = integral (1:length(A));


wolforth@pet.mni.mcgill.ca