LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT Problem

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 13
(4,154 Views)

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. Smiley Happy

 

Regards Florian

 

Message 2 of 13
(4,144 Views)

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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 13
(4,137 Views)

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

0 Kudos
Message 4 of 13
(4,128 Views)
Solution
Accepted by Strokes

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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 13
(4,121 Views)

@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

0 Kudos
Message 6 of 13
(4,117 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 13
(4,113 Views)

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

0 Kudos
Message 8 of 13
(4,111 Views)

Hi Strokes,

 

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

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(4,108 Views)

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.

0 Kudos
Message 10 of 13
(4,041 Views)