Re: Problem with fft/ifft - the thing is complex though it shouldn't



I did something similar a while back. What I can tell you is that
you need to be VERY careful when using fft/ifft this way as a filter.
You need to define your w correctly, understand the output of fft
(see help file on fft, fftshift; the comment by Jeroen is also very
valid), there is a 1/N scaling factor, etc...

I don't have the code with me, but what I suggest you do is to work
with Maple first (hopefully you have it), symbolically, with some
simple functions and compare it with your matlab code to see if you
got it right.

Mike

Jeroen wrote:


j_hab wrote:
I have a problem with the ifft. I want to filter a a time
accerleration signal (not complex) in freq domain - filter it
there
and transfer it back to time domain.
Considering the following code with acc_t as a time domain acc.
signal:

ft = fft (acc_t); % generating frequency domain
im = imag (ft);
re = real (ft);
ar = im./re; %phase angle
fta = abs (ft); amplitude spectrum

fta_w = fta.*w; % filtering with e.g. linear filter w with the
same
length of fta

re_w = cos (ar).* fta_w; %real part of filtered spectrum
im_w = sin (ar).* fta_w; % imaginary part of filtered specrtum
ft_w = complex (re_w, im_w); generating complex (filtered)
vector

% until here everything is clear

ift = ifft (ft_w); %jumpin to time domain again
%now my problem:
acc_t_w = ????????? the filtered time acceleration signal is
complex,
shall I use abs (ift or real(ift)for a correct presentation?
why
anyhow is it comlex?????

%%%%%%%%%%%%%%%%%%
Now ift is a complex signal and I DON'T KNOW WHY!!!!
If I do not apply any filter w it doesn´t become complex.
Anyhow....can I use the real part real (ift) or absolute part
abs
(ift) to present the correct (wrt the amplitude) filtered time
signal
of the acceleration acc_t?

Any kind of objective answer would be of great help.

Hi,

I had just a quick look at this, but it seems strange to me why you

split your signals into an amplitude part, and calculate the
corresponding angles also. Why not just straightforward:

X_w = fft(x_t); % To frequency domain.
X_w = X_w.*H_w; % Apply filter.
x_t = ifft(X_w); % Back to time.

Your filter 'H_w' in the frequency domain must be chosen carefully.

Suppose you have an N-point fft and you want to apply a lowpass
filter.
Then you make a real-valued lowpass filter 'H_w' first with N/2
points
from 0 Hz to fs/2. Then you make the full 'H_w' (assuming 'H_w' as
a
column vector):

H_w = [H_w ; 0 ; flipud(H_w(2:end))];

The reason for this construction is that the amplitude spectrum of
a
real signal is symmetrical around the single index (N/2 +1) (where
index
1 is DC). You may end up with very small imaginary parts in x_t due
to
calculation noise. Just take the real psrt of your result.

Jeroen

.



Relevant Pages

  • Re: Oversampling and the FFT
    ... I suggested we sample just above Nyquist and perform our 1024 point FFT. ... regardless of the window function or sample rate. ... Also the phase of a sharp filter may change ... signals near the Nyquist frequency of a given sampling rate than ...
    (comp.dsp)
  • Re: Filtering signal with rapid changes with FFT
    ... My current filtering technique is following: I make FFT of signal, take highest peak from FFT, and cut every sample in frequency domain into 0 except highest peak. ... Basicly, what I'm trying is to make filter, which would not make any phase delay for signal, and would fit for signals with different frequencies... ... What you can do is to use FFT to find the peak of the noise and then apply a notch filter. ...
    (comp.soft-sys.matlab)
  • Re: DFT point = decimated filter output?
    ... I am struggling with some FFT interpretation. ... due to far from perfect filter) ... The best way to look at the DFT is to consider it as a projection. ... Remember that the DFT is for periodic, discrete-time signals, ...
    (comp.dsp)
  • Re: Simple 150hz Low Pass Fiter using FFT?
    ... I'm looking to create a simple low pass filter in VC++ and was wondering ... How would one apply the FFT outputs to feed a low pass filter to convert ... frequency mask (for example to remove all out of the band signals), ...
    (comp.dsp)
  • Re: Neural netss (was Re: death of the mind.)
    ... its 30+ visual areas and 1100+ feedforward and feedback pathways, ... This whole thing makes sense, regards the cortex, if you think about ... feedback signals from the other 29 areas, ... they filter and perform the basic ...
    (sci.cognitive)

Loading