From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT in Labview

Hi,

I create simple program which generate signal.

1 singal: Sine Frequency:5Hz Amplitude:1

2 singal: Sine Frequency:1Hz Amplitude:0,8

3 singal: Sine Frequency:100Hz Amplitude:0,5

The signal is the sum of 3 of these signals.

Why in my program i can't see correct amplitude value in FFT spectrum? For example i can see on graph 0,12 for amplitude 0,5.

What is more, after filtration i can't see correct value frequency. For 100Hz is 0.1. Why?

 

Regards

0 Kudos
Message 1 of 9
(3,674 Views)

Because filters don't have sharp cutoff frequencies.

 

Your filter is set for 0.125  (with sampling rate 1, or 125 for sampling rate of 1000)  (Your VI would be easier to work with if you used the same sampling rate input into the filters as you used for creating the sinewaves.)

 

At the filter point, you have some attenuation of the signal that is -3db.  If you want to have.

 

Learn more about filters here.  https://en.wikipedia.org/wiki/Low-pass_filter

0 Kudos
Message 2 of 9
(3,660 Views)

But if i don't active a Case Structure with filters the FFT after filtration still show a 0,1 for 100Hz.

How to resolve?

0 Kudos
Message 3 of 9
(3,649 Views)

When I run your VI with both buttons off, and thus no filter, both the before and after FFT's show 0.125

0 Kudos
Message 4 of 9
(3,618 Views)

My sampling info in Sine waveform is set:

Fs: 1000

#s: 1000

 

So can you easily explain where change value and what and why such a value?

I would be very grateful.

0 Kudos
Message 5 of 9
(3,607 Views)

Which creates an array of data.  You then fed that array into the filter, but told the filter your sample rate is 1, not 1000.

 

When you do the later FFT, it is working on the raw array data and assumes the sample rate is 1, whereas the original FFT used the waveform wehre the dT in the waveform was 1/1000.

0 Kudos
Message 6 of 9
(3,597 Views)

I create array of data and didn't work:/

0 Kudos
Message 7 of 9
(3,563 Views)

In what way didn't it  work?  Statements like that don't tell us anything.  Did it cause an error?  Did it just not give the results you were expecting?

 

I ran your VI and I see an error on the bottom sine wave creator.

"Error -20061 occurred at NI_MABase.lvlib:Sine Waveform.vi:2090004 >> NI_MABase.lvlib:ma_Trap Fgen Parameter Errors.vi:5950001
frequency must be <= sampling rate/2"

 

Your frequency is 100 and the sampling rate is 100.  I changed the frequency to 40 (less than 1/2 of 100) and that error went away.  Then I found an out of memory error.  Because you have a 0 in Number of samples, and subtracting 1 give a -1, the while loop never stops because it is never equal to i because i starts at 0.  I put another number in for "number of samples", then the VI runs.

 

What is the point of the that while loop, anyway?

0 Kudos
Message 8 of 9
(3,539 Views)

... creating a array subset. Use "Array Subset" or "Delete From Array" instead - it is more effective. And you can try to look into e.g. http://www.ni.com/white-paper/5509/en/ (to get more insinght into signal theory).

Jozef Lipták
0 Kudos
Message 9 of 9
(3,522 Views)