Why does the time scale for a ifft depend on the frequency interval of the frequency signal?
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Pfläging
el 25 de Mayo de 2015
Comentada: Salaheddin Hosseinzadeh
el 27 de Mayo de 2015
Hello, I want to do an ifft of a given signal in the frequency domain.
To scale the time axis in the time domain, I would chose 0 as the minimal value. My problem is to understand how to define the maximum value of the time axis. I think the lowest frequency I could observe in a signal is determined by the time I'm measuring the signal. Therefore I would chose the maximum time value like this:
tmax = 1/min(freq),
where freq is a vector containing all frequencies I measured. I cannot observe a certain frequency when the measuring time is lower than half of the period time of this frequeny, right?
I know the right answer would be
tmax = 1/fs,
where fs is the distance between to adjacent frequencies. But I do not understand why it should be like this. I would rather chose the first way.
I would highly appreciate your answers!
0 comentarios
Respuestas (3)
Salaheddin Hosseinzadeh
el 25 de Mayo de 2015
I don't quite understand your question!
You may have a signal collected with the sampling frequency of Fs for a long time. What's the relation between time and sampling frequency?!
You can scale the time axis based on the data length provided to the ifft and the sampling frequency of the signal!
lets say you have 1000 data samples that goes into the ifft function, your sampling frequency is Fs, then the total time vector you need is
t = linspace(0, 1000/Fs,1000)
hope that clarifies everything.
Good luck!
1 comentario
Salaheddin Hosseinzadeh
el 26 de Mayo de 2015
Dear David,
I'm afraid you are a little confused. Nyquist rate is different from what you're talking about. please see this Sampling Frequency
Nyquist frequency says that, if you have a signal with maximum frequency (or lets say band width) of x you have to sample it at least twice the x to avoid aliasing! Thats all.
So if you sample the signal with Fs, you can only see the frequencies up to Fs/2 in the frequency domain!
Human voice is mainly about 4Khz, so a sampling frequency of 8Khz is just enough!
The time interval between your sampling will not change anyway!
BTW all your calculations are correct, so you have to write your command as such
linspace(0,N/Fs,N);
NOT
linspace(0,N/(2*Fs),N); % this is wrong
Please read a bit more a bout nyquist shannon theorem.
Good luck
1 comentario
Salaheddin Hosseinzadeh
el 27 de Mayo de 2015
Please be aware, "bandwidth" which I used in my previous answer is correct conditionally (for baseband signals)! Generally "bandwidth" is wrong.
Alfonso Nieto-Castanon
el 26 de Mayo de 2015
Editada: Alfonso Nieto-Castanon
el 26 de Mayo de 2015
If you have a signal x with N samples acquired at a sampling rate Fs, then:
1) The time axis of your vector x (the time associated with each individual sample in the vector x) is:
t = (0:N-1)/Fs;
The difference in time between two sucessive samples is 1/Fs, and the samples/elements in x range between t=0 to t=(N-1)/Fs
2) The frequency axis of your vector fft(x) (the frequencies associated with each element in the vector fft(x)) is:
f = [0:floor(N/2) -ceil(N/2)+1:-1]*Fs/N;
or you could just write f = (0:N-1)*Fs/N if you understand how frequencies above Fs/2 wrap-around the negative axis (i.e. when sampled at a sampling frequency Fs a sine with frequency -Fs/N would look just the same as a sine with frequency Fs*(N-1)/N)
The difference in frequency between two sucessive samples of fft(x) is Fs/N (this is the same as the smallest non-zero frequency that you are measuring), and the samples/elements in fft(x) range between approximately -1/(2*Fs) and 1/(2*Fs)
The two definitions that you are mentioning for tmax are just the same. In other words, min(freq) (the smallest non-zero frequency that you are measuring) is Fs/N, which is just the same as the difference between two sucessive frequencies in your frequency axis (you are naming this fs, I would probably have chosen a different name to avoid confusing this with Fs, your sampling frequency).
Also please note that, more precisely, tmax would not be equal to N/Fs but rather to (N-1)/Fs (or (1-1/N)/min(f) using your notation), but that is probably a minor point to make.
And last, regarding why your timeseries x duration (in seconds) is related to the frequency interval of your fourier transformed signal fft(x), for a fixed sampling frequency Fs, the longer that you acquire the signal x, the more densely you are able to sample the fixed -1/(2*Fs) to 1/(2*Fs) frequency interval, so it is natural that you may relate the length of your timeseries x to the density of this frequency sampling.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!