LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Spectral Measurements (FFT Module)

Hi ...
 
I cam currently developing an application which uses the FFT Module to display frequency domain data in a waveform graph. This works as expected.
 
When I try to output the data with the Write Labview Measurement File Express VI, I get strange data. Here is some sample data from that file:
 
--begin
0.000000 7.966055 6.080002 6.564292
10.000000 5.660673 4.325652 4.671261
20.000001 0.044826 0.039543 0.041005
30.000001 0.026767 0.042807 0.045995
40.000001 0.172722 0.211967 0.209600
50.000001 0.208757 0.242115 0.287101
60.000002 0.092932 0.107328 0.131984
70.000002 0.080228 0.110453 0.125919
80.000002 0.158232 0.205056 0.238829
90.000002 0.105286 0.138517 0.164002
100.000003 0.050657 0.064442 0.076628
110.000003 0.153490 0.201062 0.232917
120.000003 0.122864 0.162590 0.189690
130.000003 0.129717 0.166817 0.193355
140.000004 0.244372 0.313255 0.369355
150.000004 0.386495 0.499145 0.583249
160.000004 0.117290 0.141132 0.159929
170.000004 0.486006 0.611568 0.715969
180.000005 2.581692 3.307030 3.914445
190.000005 12.927723 16.543368 19.553471
200.000005 13.444462 17.209441 20.336366
.....
.....
.....
399950.010104 0.003843 0.002252 0.003452
399960.010104 0.005256 0.006628 0.005573
399970.010104 0.007145 0.008510 0.007706
399980.010104 0.006274 0.007517 0.007002
399990.010105 0.026896 0.026177 0.025601
--end
 
I am using exactely 80 000 samples for 0.1 samples.
 
Does anyone know where the part after the . at the frequency come from ? Shouldn't it be 400000.0000000 or 399990.000 for the last point ?
0 Kudos
Message 1 of 3
(2,669 Views)

Without see the code generating data this is only a guess, but here goes.

  1. The fact that the error starts so many decimal places out says to me that its probibly related to rounding error when dealing with floats. The basic issue is that floating point numbers aren't represented exactly in computers. There is always some rounding error involved.
  2. The fact that the error grows at a fairly constant rate tells me that the error is being compounded over time as a value is added back to itself.

Given that you are incrementing the frequency value by an integer amount, carry the frequency internally in the code (and operate on it) as an integer. Only convert it to a float as it is about to be used. This will still give a little error -- that's unavoidable -- but at least the error won't be compounding.

Of course that "solution" is dependent upon the assumptions I'm make about your code being correct. It would be helpful to see the code.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 3
(2,663 Views)
What happens if you save the data  and then try to reload the file ?

Chow
xseadog
0 Kudos
Message 3 of 3
(2,657 Views)