You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pr_spm_volterra.m
    path of file: ./repos/malini/Codes/deconvolution - model/spm8/marsbar-0.44/@mardo_99/private
    
    the code of the file until where you have to start completion: function [X,Xn,IND,BF,name] = spm_Volterra(SF,BF,name,N)
% returns [design] matrix of explanatory variables
% FORMAT [X Xn IND BF name] = spm_Volterra(SF,BF,name,N);
% SF{i}   -  multivariate causes: SF{i}(:,j) = casue i,  expansion j
% BF{i}   -  Basis functions:     BF{i}      = basis set for cause i
% name{i} -  name of cause i
% N       -  [1 or 2] order of Volterra expansion
%

    
function [X,Xn,IND,BF,name] = spm_Volterra(SF,BF,name,N)
% returns [design] matrix of explanatory variables
% FORMAT [X Xn IND BF name] = spm_Volterra(SF,BF,name,N);
% SF{i}   -  multivariate causes: SF{i}(:,j) = casue i,  expansion j
% BF{i}   -  Basis functions:     BF{i}      = basis set for cause i
% name{i} -  name of cause i
% N       -  [1 or 2] order of Volterra expansion
%
% X       -  Design Matrix
% Xn{i}   -  name of cause i (now including interactions among causes)
% IND{i}  -  indices pertaining to cause i (and interactions)
%___________________________________________________________________________
%
% For first order expansions spm_Volterra simply convolves the causes
% (e.g. stick functions) in SF by the basis functions in BF to create
% a design matrix X.  For second order expansions new entries appear
% in IND, BF and name that correspond to the interaction among the
% orginal causes (if the events are sufficiently close in time).
% The basis functions for these are two dimensional and are used to
% assemble the second order kernel in spm_graph.m.  Second order effects
% are computed for only the first column of SF.
%___________________________________________________________________________
% @(#)spm_Volterra.m	2.1 Karl Friston 99/05/11


% Construct X
%===========================================================================

% 1st order terms
%---------------------------------------------------------------------------
X     = [];
Xn    = {};
IND   = cell(1,size(SF,2));
for i = 1:size(SF,2)
	for j = 1:size(BF{i},2)
		for k = 1:size(SF{i},2)
			x      = SF{i}(:,k);
			d      = 1:length(x);
			x      = conv(full(x),BF{i}(:,j));
			x      = x(d);
			X      = [X x];
			IND{i} = [IND{i} size(X,2)];
			if size(SF{i},2) > 1
				str = [name{i} sprintf('(%i)[%i]',j,(k - 1))];
			else
				str = [name{i} sprintf('(%i)',j)];
			end