LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Amplitude of Signal after performing FFT Analysis

Solved!
Go to solution

 

 I am currently trying to find the amplitude of a signal after performing an FFT analysis. I am using this for image MTF analysis. I take the line profile of test chart (With alternating black and white bars) and convert this into a signal. This signal is then fed into an FFT Mag/Phase measure VI and outputs the FFT. My program then grabs the amplitude at the frequency of alternating black and white bars. 

 

 My issue is that the amplitude seems to be scaled by some factor. I would like to find the exact amplitude of the signal for my analysis. Does anyone know the scaling factor or of any issue with my program? I've attached the program and the image that needs to be analyzed. Just browse to the image in the VI and run the program and you will see the resultant MTF graph.

 

Thanks,

Ronak

0 Kudos
Message 1 of 14
(10,177 Views)

This may be of some help. I made for many years ago in 6.1 so it is somewhat oldschool.

You can also go to help in the toolbar then Find Examples. Search for FFT and loacte the "FFT and Power Spectrum Units.vi"

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 2 of 14
(10,165 Views)

Thanks for your help,

 

 I've figured out that with the amplitude and phase spectrum, the amplitude is scaled by 1/sqrt(2). With this scaling, the output is still off from the desired output of the line profile. I should be getting around 160 amplitude for the 20 frequency using line profile and finding amplitude with FFT. I seem to be getting 90 instead.

 

Any help would be appreciated!

0 Kudos
Message 3 of 14
(10,158 Views)

Another thing which can affect the apparent amplitude is spectral leakage.  If the frequency of the signal does not exactly match the frequency bins of the calculated spectrum, then some of the energy of that signal will appear to be in an adjacent bin.  The result is that none of the bins exactly match the amplitude of the component you are trying to measure.  The image you posted will almost certainly produce this effect.

 

Also. Please look at the style guides for LabVIEW. It is recommended to keep the size of the diagram to no larger than one screen. While I am using a modest screen, I am pretty certain that your diagram exceeds the size of your screen.  Wiring should be right to left.  Stacked sequence structures force you to violate that rule and obscure the code.  Your code could easily be rewritten without the sequence structure.  You generally do not need or want both autoindexing on for loop and wiring to the N terminal.  Equality comparisons of floating point numbers may not give what you want due to roundoff errors and the finite representation of numbers in binary.  You should use In Range and Coerce with a small tolerance around the exact value to be safe.  Create subVis to encapsulate sections of code like what you have in the sequence structure.

 

I do not have the Vision toolkit.  The attached VI shows some of the suggestions I made above, but is not intended to be fully functional.

 

Lynn 

Message 4 of 14
(10,143 Views)

Thank you John for you help,

 

I am new to LabView and I've just been trying to get the hang of programming with it. Thanks for the tips, I will definitely use them from now on. I tried to add a tolerance when trying to obtain the amplitude from the FFT graph to ensure that I will obtain the max amplitude but this amplitude is off by quite a bit (from manual testing). When I do the MTF testing manually and using the program, the shape of the graph is similar but the values are different. Could there be a scaling factor for the output? I tried sqrt(2) as this is the scaling factor for the amplitude of a sine wave (with Vrms) but this doesn't give the right answer. It is closer but hopefully there's a better scaling factor.

 

 

 

0 Kudos
Message 5 of 14
(10,092 Views)
I don't have IMAQ so I got tired of skipping the VIs.  Let me venture a guess.  Somewhere in your VI you are using the FFT spectrum VI.  In the conversion from the FFT to the single-sided spectrum there is a scaling of sqrt(2)/N.  I am guessing that the number of points is what is skewing your results.
Message 6 of 14
(10,073 Views)

Your data is more like a square wave than a sine wave so that may be part of the scaling issue.  Another possible factor is that the black and white bars occupy only about 1/6 of the width of the image you included in your original post.  The other 5/6 is not uniformly white.  The theory of Fourier transforms assumes that the signal of interest is continuous from -infinity to +infinity or is periodic and the data was sampled over exactly one period.  Neither of these assumptions is valid for your data.  You are probably lucky you got as close to the value you expected as you did.

 

Tell us exactly what you are trying to measure rather than how you are trying to do it.  Perhaps someone can offer a suggestion about how to make a meaningful measurement.

 

Lynn 

Message 7 of 14
(10,067 Views)

Hey Lynn (Sorry I got your name wrong in the previous post)

 

I'm trying to measure the amplitude of the intensity graph (outputted using Line Profile) using the Fourier transform. I will try the scaling factor of sqrt(2)/N (N being the data range?). 

 

Thanks,

Ronak

0 Kudos
Message 8 of 14
(10,060 Views)

shahronak wrote: I will try the scaling factor of sqrt(2)/N (N being the data range?). 

 



N is the number of points.

0 Kudos
Message 9 of 14
(10,057 Views)

I tried the scaling factor and that didn't work either. It gave a number about 100 times the amount of amplitude that is done through manual testing.

 

I'm currently disputing whether or not my manual testing is wrong (used line profile and just estimated amplitude). The wave does look more like a square wave but looking at resources online, there is no scaling factor for square waves, only a sign factor. I've attached my edited version of the program as it will be easier to read. Thanks for the help on refining the program Lynn.

 

 

Thanks,

Ronak

0 Kudos
Message 10 of 14
(10,032 Views)