Inconsistency when using IFFT with a real signal

2 views (last 30 days)
Hi,
I am having a strange problem with a small snippet of code that takes the fft of a real input signal, and using one half of its spectrum, recreates the signal by exploiting conjugate symmetry. The problem I'm facing is that I'm not getting a result identical to the input.
len = length(pi);
%Nyquist point for a signal of even length
halfLen = length(pi)/2 + 1;
PI = fft(pi);
PO(1:halfLen) = PI(1:halfLen);
%Exploit conjugate symmetry of the real input signal
PO(halfLen+1:len) = fliplr(conj(PO(2:halfLen-1)));
%Taking IFFT should give same signal as pi
po = ifft(PO);
Both po and pi should be identical, but they are within 1e-10 of each other which is causing colossal errors at high frequencies.
A simple bit of code but I have not been able to figure out why po ≠ pi. Any input is appreciated!
Thanks.

Accepted Answer

Walter Roberson
Walter Roberson on 22 May 2013
  1 Comment
A B
A B on 22 May 2013
Thanks very much for identifying the problem.
Could you suggest any means by which I can reduce this effect?
It seems like I needn't do much for it to rear its head!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!