LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT out of simulation loop

Hello

I have a problem how to plot FFT properly. I want to make a simulation of dynamic system and I have tried memory and collector to get signal out of simulation loop but every time the plot happens to be incorrect. I have no idea what I do wrong. Here I attach a simple example.

Simulation time is 2 s and although sine frequency is 25 the plot shows 50.

Thanks in advance.

Download All
0 Kudos
Message 1 of 5
(721 Views)

Hi Tairux,

there are several things wrong:

  • You only attach images instead of a VI. We cannot debug/edit/run images using LabVIEW!
  • Why do you need to create an array using BuildArray just to index the first element of that array? This is called Rube-Goldberg…
  • You only send an 1D array to the FFT function: there is no timing information in your data! I also don't see anything in your code related to timing informations…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(692 Views)

Right, my bad. I will attach my VI. Besides that I also tried with "Spectral Measurements" block and "Spectrum (Mag-Phase)" block but I am not sure which is best for my application. I mean I don't know exactly how to handle getting signal out of simultion loop to make FFT function work.
Thanks for reply.

0 Kudos
Message 3 of 5
(686 Views)

You want to simulate a signal.  LabVIEW has a data type called a Waveform that includes three elements -- the time (t0) at which the data were acquired, the sampling interval (dt), in seconds, between samples (so it would be 0.001 if you are sampling at 1 kHz), and an Array of Dbls (Y) containing however many Samples you acquired at a time (for example, sampling at 1 kHz for 1 second would give you an array of 1000 samples).

 

When you analyze a signal to get Spectral Data, you need to "scale" the results according to the sampling Frequency (or sampling Interval, 1/f).  If you look at the Block Diagram Palettes, you'll see one called "Waveform".  Look inside at Analog Wfms/Generation and choose "Simulate Sig", an Express VI that will simulate a Signal for you that you can feed into your Spectral Measurements Express VI.  This should work better for you.

 

Bob Schor

0 Kudos
Message 4 of 5
(647 Views)

Hi Tairux,

 

see this after reading Bob's message:




@Tairux wrote:

Besides that I also tried with "Spectral Measurements" block and "Spectrum (Mag-Phase)" block but I am not sure which is best for my application.


You should know on your own what is best for your application!

(How should we know that?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(631 Views)