%Illustrate how 2N-pt DFT of real-valued sequence 
%of length 2*N can be computed via N-pt DFT
clear all
N=32;
%Here's where me make up the signal
g=randn(1,2*N);
X=fft(g(1:2:end)+j*g(2:2:end),N);
for k=0:N-1,
X1(k+1)=0.5*(X(k+1)+conj(X(rem(N-k,N)+1)));
X2(k+1)=-j*0.5*(X(k+1)-conj(X(rem(N-k,N)+1)));
Z2(k+1)=exp(-j*2*pi*k/(2*N))*X2(k+1);
G(k+1)=X1(k+1)+Z2(k+1);
G(k+1+N)=X1(k+1)-Z2(k+1);
end
norm(G-fft(g,2*N))
