
function Y = FFTnum(sens,q,X); 
if  q  == 0
    Y = X(1,:); 
else 
    Xpair   = X(1:2:2^q,:); Ximpair = X(2:2:2^q,:); 
    Ypair   = FFTnum(sens,q-1,Xpair); Yimpair = FFTnum(sens,q-1,Ximpair); 
    K = 0:2^(q-1)-1; s = floor((1+sens)/2); n=size(Xpair,2);  
    W = exp(2*sens*i*pi*K'/2^q)*ones(1,n); 
    Yimpair = Yimpair.*W; 
    U1 = Ypair + Yimpair; U2 = Ypair - Yimpair;  
    Y = [U1;U2]/2^s;
    Y = reshape(Y,size(X));  
end
end

