LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT and Inverse FFT from Streaming Data not Working

Solved!
Go to solution

So I have a signal I want to convert from the time domain to the frequency domain.

 

I have streamed the data from the analog input to FIFO on target to the received on the Host VI.

 

However, changing the input signal frequency does not reflect on the Waveform Graph.

 

Does anyone know how to fix this?

 

Thank you.

 

 

Download All
0 Kudos
Message 1 of 13
(699 Views)

I don't use FPGA so I don't know the names or what the inputs/outputs of those first two VIs in your loop are, but it looks like the second one is the signal generator setup, which then wires something out of it, inverts it, and uses that as the ∆t for your waveform. 

 

If that's the case, then doesn't that mean that you're setting the time between points on your waveform to be based on the waveform being generated, and not on the timing of the data point reads like it should be?

 

(If that's not what you have wired in there, then disregard this...)

0 Kudos
Message 2 of 13
(670 Views)

Yes, that is exactly the case and I apologize for this confusion.

 

However, if I pick the input to the FFT function from the output of the 'DBL" function I still get the same results.

 

Corrections are attached. Hope these help.

 

Thank you.

 

Download All
0 Kudos
Message 3 of 13
(662 Views)

It's really hard to tell what's going on in your pictures.

  1. Your front panel implies a frequency of 900Hz but when I look at the waveform graph on the front panel, the period does not look like 0.001111s. I don't think you are are making a 900 Hz sine wave.
  2. You read 200 points from your FIFO and pad the FFT to 1000 points. Your sine wave makes up only 20% of your points, the rest are zeroes. If you aren't changing the frequency correctly, see 1, you may not see much of a shift in your FFT. (Depending on how many cycles are in the 200 points, you may not get an accurate FFT)
  3. You are plotting the FFT by index, there is no df in the waveform graph 2 plot.
0 Kudos
Message 4 of 13
(651 Views)

So the sine wave here is coming from an arbitrary waveform generator which is then fed into the analog input of the FPGA. As such the frequency (period) of the signal is predefined on the arbitrary waveform generator.

 

Also, my understanding of LabVIEW is still not much though I have been trying by reading a lot on the documentation and also using the examples in the Help section but getting the blocks to work seamlessly has been an issue.

 

Thank you anyway.

 

I appreciate your assistance.

0 Kudos
Message 5 of 13
(595 Views)

First, I would tell you to concentrate on digitizing the correct signal. It looks like either you are doing it wrong or interpreting the digitized signal wrong.

  1. You can attach your project here for others to look at. Note not everybody on the forum has FPGA, so be patient.
  2. It's hard to tell what your digitizing settings are. It seems you are showing the RT loop as you are reading 200 points from a FIFO every 1 ms. If the plot on your figure has 200 points and a .1s period, your dt is then 0.0005s. This value, although sufficient for 900 Hz, would not yield a smooth sinusoidal; you are almost at Nyquist.
  3. What does the FPGA loop look like?
0 Kudos
Message 6 of 13
(591 Views)

I will be sharing my project file with you here.

 

I have been trying a bunch of different things so I want to move this specific one to a different project so I can share.

 

Once again thank you very much.

 

 

0 Kudos
Message 7 of 13
(587 Views)

This is a simplified version of the project files including the VIs.

 

You can have a look at it.

0 Kudos
Message 8 of 13
(571 Views)

I don't have Real Time or FPGA on this computer, but I was able to peak at the FPGA code.

 

You need to put a loop timer in the code to have the loop run at a predictable rate. What do you want your Sampling Rate to be on the Analog Input? Note it has to match the capabilities of your digitizer. The loop timer below can be set in ticks, us, and ms, set it for the correct value. That should clear up the Analog Input part of your FPGA. When I get a chance, probably not till late tonight, I'll try to look at the RT code on another computer. The time you set here should match your dt on the RT loop; then your timing will be correct.

 

 

mcduff_1-1720644285503.png

 

0 Kudos
Message 9 of 13
(564 Views)

So I am not using a digitizer in this case but an FPGA with a sampling frequency of 200 kSa/s.

 

My analog signal is coming from an arbitrary waveform generator with a sampling frequency of 150 MSa/s.

0 Kudos
Message 10 of 13
(560 Views)