function X = dft( x ) % our straight-up DFT implementation % find the length of x [height width] = size(x); % transpose if necessary if height > width x = x'; [height width] = size(x); end % the dimension of the DFT N = width; % sanity check if height ~= 1 fprintf( 'error: dft expects row or column vector\n\n' ); return; end % generate DFT matrix F = dftm( N ); % multiply X = ( F * x' )';