function y = myFFT_PB15000134(x,N)
%x: У 
%N: DFT 
%X: УΪ N

nx = 0:N-1;
nx = nx';
j1 = N/2;
    for i1 = 1:N-1 
        if i1<j1
            temp = nx(j1+1);
            nx(j1+1) = nx(i1+1);
            nx(i1+1) = temp;
        end
        k = N/2;
        while(j1>=k)
            j1 = j1-k;
            k = k/2;
        end
        if j1<k
           j1 = j1+k;
        end
    end

y = x(nx+1);    %Ϊĳʼֵ

m = log2(N);
for mm = 1:m                    %DFTmλ2ֽ⣬ңÿηֽDFT
    Nmr = 2^mm;
    u = 1;                      %תuʼ
    WN = exp(-1i*2*pi/Nmr);     %ηֽĻDFTWNexp(-i*2*pi/Nmr)
    for k1 = 1:Nmr/2            %οԽڵĸε㣬1->2->4->8->...
        for kp1 = k1:Nmr:N      %εĿԽΪNmr=2^mm 
            kp2 = kp1+Nmr/2;    %ȷĶӦԪ±
            t = y(kp2)*u;       %ĳ˻
            y(kp2) = y(kp1)-t;  %ļӷ
            y(kp1) = y(kp1)+t;  %Żԭ±λ
        end
        u = u*WN;               %޸תӣһDFTWN
    end
end

end