Cart | Help
 You are here: NI Home > NI Developer Zone > NI Discussion Forums Select Community English Français Italiano 日本語 한국어 Español 简体中文 繁体中文 Português (BR)

Member
Posts: 157

# FFT Problem

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

Member
Posts: 96

# Re: FFT Problem

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

Proven Zealot
Posts: 7,152

# Re: FFT Problem

[ Edited ]

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?

Best regards,
GerdW

CLAD, using 2009SP1 + LV2011SP1 on WinXP+Win7+cRIO
Kudos are welcome
Member
Posts: 157

# Re: FFT Problem

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

Proven Zealot
Posts: 7,152

# Re: FFT Problem

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...)

Best regards,
GerdW

CLAD, using 2009SP1 + LV2011SP1 on WinXP+Win7+cRIO
Kudos are welcome
Member
Posts: 157

# Re: FFT Problem

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

Proven Zealot
Posts: 7,152

# Re: FFT Problem

Hi Strokes,

"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?"

Yes, it is wired so...

"I thought it would somehow resemble a sine wave.,,?"
It does resemble a sine wave... Look more closely!

Best regards,
GerdW

CLAD, using 2009SP1 + LV2011SP1 on WinXP+Win7+cRIO
Kudos are welcome
Member
Posts: 157

# Re: FFT Problem

GerdW wrote:

Hi Strokes,

"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?"

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?

Proven Zealot
Posts: 7,152

# Re: FFT Problem

Hi Strokes,

I would recommend one or two semester at a high school/university for basics of filters!? Read wikipedia etc...

Best regards,
GerdW

CLAD, using 2009SP1 + LV2011SP1 on WinXP+Win7+cRIO
Kudos are welcome
Member
Posts: 2

# Re: FFT Problem

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.