LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to measure the bandwidth

Solved!
Go to solution

Hey,

i made a small code  which can calculate the bandwidth of a FFT Spectra but i need some improvements of this caluclation.

what i have done is:

 

1- i calculated the FFT of the time signal.

2- i calculated the maximum of the FFT spectra and devided it by 2 in order to have the half max.

3- i made linear interpolation using the equation ( x = x0 + ((x1-x0)*(y-y0)) / (y1-y0) ) and used the half max. as input for y .

4- i used the curser legend in order to determine the 2 points (x0,y0) , (x1,y1) needed for the linear interpolation and then i wrote the values of these points into the "Bandwidht calculation" controls in order to find x, wich is the bandwidth.

 

 is there maybe better idea to calculate it? i mean how can i change the code so that i can find the Bandwidth automatically without needing to give the values of these 2 points?

thanks

here is my code..

 

0 Kudos
Message 1 of 4
(3,940 Views)
Solution
Accepted by Oliver2000

Since the first point is greater than half max, I am not sure how meaningful the calculation is.

 

One way to find the half max point is to use the Threshold 1D Array function.  It only works on arrays with increasing values, so to find the falling threshold, subtract the array from the peak value.

 

I attached a modification of your VI to show one way of doing this.  I also showed how the calculation can be done with LV math primitives rather than the Formula node.

 

Lynn 

0 Kudos
Message 2 of 4
(3,923 Views)

@Lynn: REALLY many many thanks..

just small question to ur code, should the  "fractional index or x" be the x value i search for?  if yes,  why do its values varys between 1 to 99 however my x-achse varys between 0 to 0,5 ?!

0 Kudos
Message 3 of 4
(3,913 Views)

The "fractional x or x" value will be the equivalent index where the array would reach the threshold which is set to half the maximum.  There are 100 elements in the FFT spectrum so the maximum index is 99.  When the curves flatten out, the value may not go down to half max and thus the maximum index results.

 

Note that this code is not particularly robust.  It works nicely for the waveform you get with x, y, and z near zero.  If you had a spectrum with multiple peaks or one which flattens out as above, this may not be very good.  If you have a single peak with a well defined half max, it should find the falling side.  The Threshold 1D Array function without the subtraction should find a rising peak, provided that the first element must be below the threshold.  See the help for the function for more details.

 

Lynn 

0 Kudos
Message 4 of 4
(3,900 Views)