I have got a question concerning the definition of the frequency vector for an fft operation.
Generally, I work with a frequency vector, f
, with power of 2 elements (2048, 4096, 8192, ...).
Given a certain simulation analysis time, time
(e.g. 600s), I should define f
as follows:
% Frequency defition
t = 0:dt:(time-dt);
df = 1/(time);
fn = Nfft/time;
$$ f = -f_{n}/2:df:f_{n}/2-1; $$
where $ f_{n} $ represent the Nyquist cut-off frequency.
Actually, for:
- computational reasons
- symmetry of the power spectra along
f
axis - not throwing away
real
orimag
part of thefft
I aim to define only half of the frequency range, as for example
$$ f = 0:df:f_{n}/2-1; $$
After calling the fft
of my input signal, I would get the desired time series as
ouput = [real(fft) imag(fft)];
But, this way, I count the 0
frequency term twice and the -fn/2
is completely discarded.
How would it be possible to emcompasses the whole standard frequency range starting from only half of it?
fftshift
will help you? $\endgroup$ – Eddy_Em Apr 8 '13 at 19:59fftshift
be helpful?fftshift
is only meant to center thefft
results about the0
component. $\endgroup$ – fpe Apr 8 '13 at 20:02fft
return vector for frequencies from 0 to $f_n-1$,fftshift
moves zero to center and frequencies vector would be exactly $[ -f_n/2 : df : f_n/2 -1 ]$. I think, I don't understand your question. $\endgroup$ – Eddy_Em Apr 8 '13 at 20:090
component twice this way? $\endgroup$ – fpe Apr 8 '13 at 20:120
twice yourself when you do[-fliplr(f) f]
$\endgroup$ – lxop Apr 8 '13 at 20:53