LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Perform FFT on a imported AC signal

I'm trying to perform FFT on a AC signal I get from simulation in Multisim. What I am trying to do is perform FFT on the signal and get the sprectrum analysis of it. I'm having an issue with the time/frequency. I'm reading in the waveform data from a text file and then using the "Build Waveform (Analog Waveform) Function" VI to build the waveform. I have the Y and t0 of the data but not the dt. The time between my data points isn't constant, it's not repeating with a exact multiple. Is there a way to get around this issue or do you have to have the data points in a multiple of each other?

 

Below is some of the values from my waveform data:

Time                                    Vout

0.00000000000000000000000 1.113451907
0.00000000973749278275346 1.114571003
0.00000001890203943672660 1.118585123
0.00000003167834430646360 1.127783288
0.00000004508519688890020 1.140418543
0.00000006397317899792450 1.160018234
0.00000008230308807093690 1.178005206
0.00000010368487704399300 1.194735746

 

Attached is the VI I made.

0 Kudos
Message 1 of 5
(2,891 Views)

akhurash,

 

For the small data set you showed it looks like the dt is approximately 0.0000000097.  The differences are probably due to the finite represention in binary of values that cannot be repesented exactly as a Double.

 

I suggest simply taking the difference between the first two elements of the time column (which equals the second element if the first element is always zero) and using that as dt.  Differences beyond the 15th significant digit cannot be preserved with the double data type.

 

You expand the Build Waveform primitive to get the dt terminal.

 

Lynn

0 Kudos
Message 2 of 5
(2,878 Views)

Thank you for the fast reply johnsold. Unfortunately I have over 1700 points and I plotted the “time” and the line isn’t exactly linear. Attached is an image of the graph of the time. I cannot post the waveform but as you will see from the plot the time isn’t linear but I will try the dt value you suggested and see what happens. The signal I'm working with has a period of 5.87us and the shape of the wave is very unquie, so I need all those points to represent it properly. But maybe I could use less points, I will into that too. Thanks.

0 Kudos
Message 3 of 5
(2,875 Views)

It would help if you could post the data.

 

I do not recall where it is located but there is a Resample VI which will interpolate irregularly sampled data so that FFTs and other fixed time interval VIs (like filters) will work.

 

Lynn

0 Kudos
Message 4 of 5
(2,868 Views)

There are several Resample VIs.  You can find them by using the palette search (show palette, click the magnifying glass in the top right, type "resample").  You probably want Resample (constant to variable, single-channel).vi, found in the Signal Processing » Signal Operation palette.  You will be using it in the opposite sense, so will need to determine your "times" based on equal sampling.  I would probably do a line fit through your current timestamps, then do the math to get the "times" you want for linear resampling.

 

Alternately, you can just ignore the whole thing and take the FFT on the current data.  You will get some noise due to the jitter in the X locations, but it might not matter.  Consult page 575 of the online Numerical Recipes in C for a fairly complete discussion of the issue.

0 Kudos
Message 5 of 5
(2,844 Views)