I consider a signal of length $N = 2^n$ for some $n$. I want to derive two signal from it, one containing only the odd frequencies and one only the even frequencies. Each of these signals have length $N/2$.

I use this code in MATLAB:

n = 3;
N = 2^n;

signal = ifft( rand(1,N) );

for i = 1:length(signal)/2
    sig1(i) = (signal(i) + signal(i+N/2)) ;
    sig2(i) = (signal(i) - signal(i+N/2)) ;

stem(0:N-1,  abs(fft(signal)),'k');
hold on
stem(0:2:N-1, abs(fft(sig1)), 'b*');
hold on;
stem(1:2:N-1, abs(fft(sig2)),'rs');

What I should get are two signals, each one of length $N/2$. One containing only the even frequencies and the other one only the odd ones. The way I proceed can be seen either as the first step of the butterfly algorithm in the FFT, or, by using a FIR filter approach, by applying two different filters to my original signal.

However, the signal containing the odd frequencies is always off and when I compare the FFTs they do not match. Why? What is the explanation? I am a bit puzzled by this result.

  • $\begingroup$ What do you mean by your last paragraph? Namely with that the odd signal is always "off". Do you mean that it is shifted to the left or right? $\endgroup$
    – fibonatic
    Nov 12 '16 at 0:54
  • $\begingroup$ Are you confusing odd/even frequencies and odd/even symmetry? You method looks like it is trying to do odd/even decomposition. The way to get odd/even frequencies is details simply in the answer from msm $\endgroup$ Jan 12 '17 at 7:59

I think you need to change your code as follows

n = 3;
N = 2^n;
signal = rand(1,N);

fft_sig = fft(signal);
fft_sig1 = fft_sig(1:2:end);  % even/odd frequencies
fft_sig2 = fft_sig(2:2:end);  

sig1 = ifft(fft_sig1);        % the actual time-domain signals
sig2 = ifft(fft_sig2); 

stem(0:N-1,  abs(fft_sig),'k');
hold on
stem(0:2:N-1, abs(fft_sig1), 'b*');
stem(1:2:N-1, abs(fft_sig2),'rs');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.