Hi. I've a signal data that I obtained by sampling it at 1024Hz. Assuming my data is of length 300 seconds. It has amplitude values (signal voltage). I can plot a graph of the values vs. time. I like to convert this data into frequency domain. So, this is what I did: 1. perform a fft on the signal data using fftw and obtained an output 2. take the absolute values of the output from (1) 3. take the result from (2) and obtain the PSD i.e. output^2/N where N is the number of fft points. (300x1024) My question now is a. with the results I obtained from (3), how do I plot it against frequency? I mean, where is the frequency info? From the input signal source, I had time information, and after fft, I supposed I have the frequency information. But how do I obtain it? b. I want to see how this frequency plot changes over time. So, I segment the data at every seconds, with 0.5 seconds of overlap. If this is what I do, would the answer to (a) be any different? Meaning, is there a different way to obtain the frequency information? Thank you for reading my questions. I've read some references before I post the questions. But I'm still confused when come to implementing it in programming. Marc

# convert data to frequency domain

Started by ●May 22, 2011

Reply by ●May 22, 20112011-05-22

As posed, I don't believe your question(s) is/are "answerable". That said, no reason to suspect your problem not "solvable". {self test question} Why no conflict in above? Marc2050 wrote:> Hi. > > I've a signal data that I obtained by sampling it at 1024Hz. Assuming my > data is of length 300 seconds. > It has amplitude values (signal voltage). I can plot a graph of the values > vs. time.So?/So what?/Means?> > I like to convert this data into frequency domain.WHY? [True Confession Time - there's a certain elder of this group who regularly chided me for not giving enough background to my questions. ;]> So, this is what I did: > 1. perform a fft on the signal data using fftw and obtained an output > 2. take the absolute values of the output from (1) > 3. take the result from (2) and obtain the PSD i.e. output^2/N where N is > the number of fft points. (300x1024) > > My question now is > a. with the results I obtained from (3), how do I plot it against > frequency? I mean, where is the frequency info? From the input signal > source, I had time information, and after fft, I supposed I have the > frequency information. But how do I obtain it?SHORT answer - you already did ;/ MORE USEFUL answer - perform following experiment Create artificial test signals of 3 seconds duration (defining PI as 3.14) f1(t) = sin(5*2*PI*t) + sin(7*2*PI*t) f2(t) = cos(5*2*PI*t) + cos(7*2*PI*t) f3(t) = cos(5*2*PI*t) * cos(7*2*PI*t) Plot the 9 results. Questions to group - was my choice of constants perverse enough to be educational?> b. I want to see how this frequency plot changes over time. So, I segment > the data at every seconds, with 0.5 seconds of overlap. If this is what I > do, would the answer to (a) be any different? Meaning, is there a different > way to obtain the frequency information? > > Thank you for reading my questions. I've read some references before I post > the questions. But I'm still confused when come to implementing it in > programming. > > Marc

Reply by ●May 22, 20112011-05-22

On May 22, 5:06 am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote:> Hi. > > I've a signal data that I obtained by sampling it at 1024Hz. Assuming my > data is of length 300 seconds. > It has amplitude values (signal voltage). I can plot a graph of the values > vs. time. > > I like to convert this data into frequency domain. > So, this is what I did: > 1. perform a fft on the signal data using fftw and obtained an output > 2. take the absolute values of the output from (1) > 3. take the result from (2) and obtain the PSD i.e. output^2/N where N is > the number of fft points. (300x1024) > > My question now is > a. with the results I obtained from (3), how do I plot it against > frequency? I mean, where is the frequency info? From the input signal > source, I had time information, and after fft, I supposed I have the > frequency information. But how do I obtain it?Output of the FFT will be in 1/Sample_period Hz resolution, so 1/300seconds = .003333 Hz so first FFT output is frequency component at 0 Hz, second is . 003333Hz, third is .006666Hz etc> b. I want to see how this frequency plot changes over time. So, I segment > the data at every seconds, with 0.5 seconds of overlap. If this is what I > do, would the answer to (a) be any different? Meaning, is there a different > way to obtain the frequency information?this case the FFT resolution will be 1/1 = 1Hz, so first component is DC, second is 1 Hz, third is 2 Hz etc.....> > Thank you for reading my questions. I've read some references before I post > the questions. But I'm still confused when come to implementing it in > programming. > > Marc

Reply by ●May 22, 20112011-05-22

On May 22, 5:06 am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote:> Hi. > > I've a signal data that I obtained by sampling it at 1024Hz. Assuming my > data is of length 300 seconds. > It has amplitude values (signal voltage). I can plot a graph of the values > vs. time. > > I like to convert this data into frequency domain. > So, this is what I did: > 1. perform a fft on the signal data using fftw and obtained an output > 2. take the absolute values of the output from (1) > 3. take the result from (2) and obtain the PSD i.e. output^2/N where N is > the number of fft points. (300x1024) > > My question now is > a. with the results I obtained from (3), how do I plot it against > frequency? I mean, where is the frequency info? From the input signal > source, I had time information, and after fft, I supposed I have the > frequency information. But how do I obtain it?Output of the FFT will be in 1/Sample_period Hz resolution, so 1/300seconds = .003333 Hz so first FFT output is frequency component at 0 Hz, second is . 003333Hz, third is .006666Hz etc> b. I want to see how this frequency plot changes over time. So, I segment > the data at every seconds, with 0.5 seconds of overlap. If this is what I > do, would the answer to (a) be any different? Meaning, is there a different > way to obtain the frequency information?this case the FFT resolution will be 1/1 = 1Hz, so first component is DC, second is 1 Hz, third is 2 Hz etc.....> > Thank you for reading my questions. I've read some references before I post > the questions. But I'm still confused when come to implementing it in > programming. > > Marc

Reply by ●May 22, 20112011-05-22

>On May 22, 5:06 am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: >> Hi. >> >> I've a signal data that I obtained by sampling it at 1024Hz. Assumingmy>> data is of length 300 seconds. >> It has amplitude values (signal voltage). I can plot a graph of thevalues>> vs. time. >> >> I like to convert this data into frequency domain. >> So, this is what I did: >> 1. perform a fft on the signal data using fftw and obtained an output >> 2. take the absolute values of the output from (1) >> 3. take the result from (2) and obtain the PSD i.e. output^2/N where Nis>> the number of fft points. (300x1024) >> >> My question now is >> a. with the results I obtained from (3), how do I plot it against >> frequency? I mean, where is the frequency info? From the input signal >> source, I had time information, and after fft, I supposed I have the >> frequency information. But how do I obtain it? > >Output of the FFT will be in 1/Sample_period Hz resolution, so >1/300seconds = .003333 Hz > >so first FFT output is frequency component at 0 Hz, second is . >003333Hz, third is .006666Hz etc > > >> b. I want to see how this frequency plot changes over time. So, Isegment>> the data at every seconds, with 0.5 seconds of overlap. If this is whatI>> do, would the answer to (a) be any different? Meaning, is there adifferent>> way to obtain the frequency information? > >this case the FFT resolution will be 1/1 = 1Hz, so first component is >DC, second is 1 Hz, third is 2 Hz etc..... > >Thank you. That's very helpful! Should it be 1/(300*1024) or should it be 1/300? Since my input has samples of total size 300*1024. Should it not be 1/(300*1024)? Thanks again!

Reply by ●May 22, 20112011-05-22

On 5/22/2011 3:58 PM, Marc2050 wrote:> Thank you. That's very helpful! > Should it be 1/(300*1024) or should it be 1/300? Since my input has samples > of total size 300*1024. Should it not be 1/(300*1024)? > > Thanks again!fs = 1024 the sampling frequency T=1/1024 the sampling interval = 1/fs the sampling frequency. W = 300 seconds the window length N = W/T = 300 * 1024 the number of samples. Frequency interval in fft fs/N = 1024/1024*300 = 1/300 = 1/W Maximum frequency in fft = fs - 1/W. So, no it isn't 1/(300*1024). - The frequency interval is independent of the sample rate and only dependent on the window. Just as - the time/sample interval is independent of the window and only dependent on the sample rate. These are duals in time and frequency. Fred

Reply by ●May 23, 20112011-05-23

On May 22, 3:58 pm, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote:> >On May 22, 5:06 am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > >> Hi. > > >> I've a signal data that I obtained by sampling it at 1024Hz. Assuming > my > >> data is of length 300 seconds. > >> It has amplitude values (signal voltage). I can plot a graph of the > values > >> vs. time. > > >> I like to convert this data into frequency domain. > >> So, this is what I did: > >> 1. perform a fft on the signal data using fftw and obtained an output > >> 2. take the absolute values of the output from (1) > >> 3. take the result from (2) and obtain the PSD i.e. output^2/N where N > is > >> the number of fft points. (300x1024) > > >> My question now is > >> a. with the results I obtained from (3), how do I plot it against > >> frequency? I mean, where is the frequency info? From the input signal > >> source, I had time information, and after fft, I supposed I have the > >> frequency information. But how do I obtain it? > > >Output of the FFT will be in 1/Sample_period Hz resolution, so > >1/300seconds = .003333 Hz > > >so first FFT output is frequency component at 0 Hz, second is . > >003333Hz, third is .006666Hz etc > > >> b. I want to see how this frequency plot changes over time. So, I > segment > >> the data at every seconds, with 0.5 seconds of overlap. If this is what > I > >> do, would the answer to (a) be any different? Meaning, is there a > different > >> way to obtain the frequency information? > > >this case the FFT resolution will be 1/1 = 1Hz, so first component is > >DC, second is 1 Hz, third is 2 Hz etc..... > > Thank you. That's very helpful! > Should it be 1/(300*1024) or should it be 1/300? Since my input has samples > of total size 300*1024. Should it not be 1/(300*1024)? > > Thanks again!It's 1/300, the full equation is sample_rate/Number of samples in FFT= 1024/(300*1024) = 1/300 Hz, that is a very large FFT by the way!!!!

Reply by ●May 23, 20112011-05-23

On May 22, 2:06�pm, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote:> Hi. > > I've a signal data that I obtained by sampling it at 1024Hz. Assuming my > data is of length 300 seconds. > It has amplitude values (signal voltage). I can plot a graph of the values > vs. time. > > I like to convert this data into frequency domain. > So, this is what I did: > 1. perform a fft on the signal data using fftw and obtained an output > 2. take the absolute values of the output from (1) > 3. take the result from (2) and obtain the PSD i.e. output^2/N where N is > the number of fft points. (300x1024) > > My question now is > a. with the results I obtained from (3), how do I plot it against > frequency? I mean, where is the frequency info? From the input signal > source, I had time information, and after fft, I supposed I have the > frequency information.No, you don't. You have Fourier coefficients.> But how do I obtain it?You need to deduce this from the FFT configuration, that is, the number of DFT points and the sampling rate.> b. I want to see how this frequency plot changes over time. So, I segment > the data at every seconds, with 0.5 seconds of overlap. If this is what I > do, would the answer to (a) be any different? Meaning, is there a different > way to obtain the frequency information?Provided you are able to link up the various pieces of information correctly under pt a), the spectrogram is one of many ways to try and extract frequency vs time relations. Filterbanks and wavelets are alternatives, each with their own quirks and idiosyncracies.> Thank you for reading my questions. I've read some references before I post > the questions. But I'm still confused when come to implementing it in > programming.You need to understand *what* to do before you have any chance of finding out *how* to do it. Rune