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: 

Data Comparison

Hello 

 

I have simulated a sine wave using the 'simulate signal' block and stored ther resulting waveform as a TDMS file. 

When I read the file and compare it with the generated sine wave of similar properties, I expect a constant true(LED) output.

Eventhough the probes show similar values under highlight, on comparison the 'equal' comparator does not give a consistent 'true' output.

 

Thanks 

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

Have you tried comparing just the Y-values from the waveform? A waveform contains a t0 timestamp which will differ depending on when the waveform was started/saved so that might be why it's not showing as equal. Also, is there possibility in your code for the sine waves to become out of phase?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 5
(2,561 Views)

Also keep in mind that it is a real bad idea to compare floating point numbers by equal. You should compare the waveform to an envelope function.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 5
(2,555 Views)

Norbert - I agree with you (if you have data from two different sources - a DBL of 0 doesn't always equal (bitwise) another 0) but in this case I would have hoped that the sine wave function to generate exactly the same values in both cases (assuming the parameters are the same)


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 5
(2,533 Views)

@Sam_Sharp wrote:

[...] (assuming the parameters are the same)


That might be true for this instance, yes, but we urge for generic solutions, do we? 😉

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 5 of 5
(2,531 Views)