06-14-2012 04:25 AM
I'm trying to compute the FFT of several signals, I've used sine waves in the attached vi to highlight my problem.
I created 3 sine wave signals using the generate signal express vi.
Sine wave 1: Fs = 20Hz
Sine wave 2: Fs = 250Hz
Sine wave 3: Fs = 500Hz
I've combined these signals into a array and fed them into FFT Soectrum (Mag-Phase) VI and plot the results on a waveform chart. I've changed the charts multiplier property to the sampling rate of the combined singal (Sine wave 1 + Sine Wave 2 + Sine Wave 3) which is equal to 770Hz.
The plot of the FFT spectrum is throwing up totally unexpected results. I would have expected peaks at 20Hz, 250hz and 500Hz, however I'm getting crazy values.
Am I doing something wrong..? Have a look at the attached vi please.
Strokes
Solved! Go to Solution.
06-14-2012 06:02 AM
The graph displays the frequencies of the input waveforms correctly if you remove your rescaling of 770 and set it back to 1.
The sampling rate of all of your inputs is actually set to 1kHz in the express vis - but that is not important for your problem.
The resolution of the FFT depends on the duration of the input waveform (0.1 seconds in your vi). That why the df of your FFT is 10 Hz.
But you don't have to rescale your x axis in any case.
Sorry - finding it hard to express my thoughts atm. Lunch has left me lethargic.
No rescaling.
Regards Florian
06-14-2012 06:25 AM - edited 06-14-2012 06:25 AM
Hi strokes,
"I've changed the charts multiplier property to the sampling rate of the combined singal (Sine wave 1 + Sine Wave 2 + Sine Wave 3) which is equal to 770Hz."
- Why did you change the multiplier property of the x scale?
- How do you calculate sampling frequencies? Do you always add up some expected signal frequencies? What's the relation between sampling frequency and signal frequency, in your opinion?
06-14-2012 06:49 AM
I'm totally new to signal processing so I messing about to see what works and what doesn't. I've been trying to apply what I've been reading and using trial and error. I will admit that sampling frequency and signal frequency confuse me when used together.
My end goal is to test the labVIEW filter vis. So I am applying a known input from the signal generator express vi's, finding there main frequency components as I may not know the signal generators signal frequency if I applied the vi to real world data and attempting to use filters to filter out certain frequencies.
I've attempted a bandpass butterworth filter to eliminate two of my signals but I must have configured it incorrectly.
Any suggestions? VI is attached.
Live and Learn and all that..
Strokes
06-14-2012 07:05 AM
Hi Strokes,
you seem to miss some basics about LabVIEW datatypes and their handling...
You cannot add waveforms by appending their Y arrays into a bigger array, you actually have to add them!
Play with the filter order in the attachment (making a control from it may make this easier...)
06-14-2012 07:33 AM
@GerdW wrote:
Hi Strokes,
you seem to miss some basics about LabVIEW datatypes and their handling...
You cannot add waveforms by appending their Y arrays into a bigger array, you actually have to add them!
Play with the filter order in the attachment (making a control from it may make this easier...)
Thanks, this is helping a lot.
You're spot on about the my confusion with Sampling Frequency and Signal Frequency but I think it's finally clicked. One final thing.. should the FFT after the filter not have eliminated the low and high frequency components completely? And is "FFT Plot 4 - 2" in the vi, the result of the filter? I thought it would somehow resemble a sine wave.,,?
Maybe I'm missing the picture altogether..
Cheers
06-14-2012 07:37 AM
Hi Strokes,
"should the FFT after the filter not have eliminated the low and high frequency components completely?"
No. You should read some lessons about filters...
"And is "FFT Plot 4 - 2" in the vi, the result of the filter?"
Yes, it is wired so...
"I thought it would somehow resemble a sine wave.,,?"
It does resemble a sine wave... Look more closely!
06-14-2012 08:05 AM
@GerdW wrote:
Hi Strokes,
"should the FFT after the filter not have eliminated the low and high frequency components completely?"
No. You should read some lessons about filters...
"And is "FFT Plot 4 - 2" in the vi, the result of the filter?"
Yes, it is wired so...
"I thought it would somehow resemble a sine wave.,,?"
It does resemble a sine wave... Look more closely!
Any good links to filter info. A search can through up a lot so maybe you have preferred articals on them?
06-14-2012 08:07 AM
08-14-2012 06:19 AM
Hi
How to change frequency resolution for FFT. If I have 40 second time data and I want frequency resolution to be 1Hz, please suggest.