imin = 7;
imax = 12;
nrep = 3;
mytiming = zeros((imax-imin+1), 1);
mynaivetiming = zeros((imax-imin+1), 1);

for i = imin:imax
      np = 2^i;
      x = rand(np, 1);
      tic();
      for j=1:nrep
          X = myradix2dft(x);
      end
      mytiming(i-imin+1) = toc()/nrep;
      tic();
      for j = 1:nrep
          X1 = mynaivedft(x);
      end
      mynaivetiming(i-imin+1) = toc()/nrep;
      fprintf('%15i  %.5g\n', np, norm(X - X1, inf))
end

nps = 2.^(imin:imax);
loglog(nps, mytiming, 'ro-')
hold on
loglog(nps, mynaivetiming, 'bo-')
loglog(nps, (nps ./ 2^imax).^2, '--')
grid on
xlabel('array size')
ylabel('time (sec)')
title('fft vs naive ft')
legend('fft', 'naive')
hold off
