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: 

How to perform Fourier transform on XY graph?

Hi everyone, 

 

I'm trying to simulate a Fabry-Perot interferometer using LabVIEW 2016 and I need to get the Fourier Transform from an XY graph.

I made the program which I attached in this post as a .zip file with all the information necesary.

This is the first time I do something using the Fourier Transform function, so I would like to know if I'm getting the correct waveform... and also I don't know how to change the values for the X axis in the wavefrom graph to have them in terms of frequency (lambda).

 

I hope someone can help me out with this. Thank you.

0 Kudos
Message 1 of 7
(1,699 Views)

I don't understand your question.  What do you mean by "perform FFT on XY graph"?

 

FFTs are performed on data that is evenly spaced.  It appears you  have generated evenly spaced data and were able to do the FFT on that.

 

Note that the results of the FFT won't appear like they come from the original data based on the FFT function you used.  That is because the  x-axis and y-axis are normalized based on the number of bins and the number of samples.  You'll have to dig deeper into the help to convert the bin number on the X-axis to the corresponding frequency, and the amplitude on the Y axis to the amplitude of the signal.

0 Kudos
Message 2 of 7
(1,653 Views)

Sorry for the misunderstood question, what I want basically is to apply the Fourier Transform to the result I get from the XY graph... did I do it right?

 

Can you tell me how can I convert the bin number on the X-axis to the corresponding frequency, and the amplitude on the Y axis to the amplitude of the signal?

0 Kudos
Message 3 of 7
(1,644 Views)

But you don't GET data from an XY graph.  You send data TO an XY graph.  Just do the FFT on the data you are sending to it.

 

As for the conversions, like I said read the help.

 

I throw out some stuff based on my my memory is, but I might be wrong, and I'd research this myself all over again if this was my project.

 

1.  X bins,  The x axis is 0, 1, 2,     The frequency bins are dF  for the sampling frequency divided by the total number of samples.  This I verified by looking at that help file.  So if you sampled at 1 Hz, and collected 100 samples,  each bin represents another .01 Hz of frequency.

 

2.  Y amplitudes,  it is basically how many samples wound up falling into that bin.  The amplitude of most bins was cut in half sine this FFT does the full range from 0 to the sampling rate.  That is why it looks mirrored.  The FFT's you are familiar with  stop at Nyquist, and the higher end is folded back and added to the lower end.  I think you need to divide by output of this FFT by the total number of samples to get the amplitude of the original signal.   But my memory is fuzzy on this.

 

 

0 Kudos
Message 4 of 7
(1,636 Views)

This is not the place to try to teach Signal Theory, and explain what a Fast Fourier Transform (or FFT) is and does.

 

One minor correction to RavensFan's last reply.  When you do Frequency Analysis of a signal, you get two values for each frequency in your signal, namely its Amplitude and its Phase.  There's a general principle of Data Analysis that if you have N data points, you can't have more than N independent "descriptors" for your data, which means that with N data points, you can represent only N/2 "frequency" values (as each one needs an Amplitude and a Phase).  

 

So how can you understand the N points in a Real FFT?  Simple -- they represent two amplitudes at N/2 frequencies (so if you sample 100 points in 1 second, you have frequency information at frequencies of 0 to 50 Hz, not 0 to 100 Hz).  This weirdness is closely related to the concept of aliasing (and something called the Nyquist frequency, which is simply half the sampling frequency).

 

Read the Help for the Real FFT and note how Frequency is arranged on the X Axis.

 

Bob Schor

0 Kudos
Message 5 of 7
(1,601 Views)

Is there a function in LabVIEW that allows me to modify the X and Y values to the Waveform Graph?

0 Kudos
Message 6 of 7
(1,584 Views)

No.

 

A waveform graph does not have X values.  It is a series that is based on a starting point (T0) and a difference between values  (dT) for as many values are needed based on the number of data values in the Y array.

 

Because your original data is evenly spaced, I don't know why you are worrying about XY graphs.  As I said earlier, you don't perform FFT's on charts or graphs, you perform it on data.  So do the FFT on your Y data.

 

It seems like you are trying to find a solution to a problem that you don't actually have.

0 Kudos
Message 7 of 7
(1,576 Views)