LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing Waveforms

Hello All.
 
I am comparing two waveforms(actually I have to acquire 1 wave forms then compare with a master waveform reading from the file)...but I am just checking it by writing a code which I am attaching with the post.....what I want to do is to compare the aggregates of two waveforms.....within 5 % Error..........but even when I apply the same sine wave(of same frequencies) I am not getting the Boolean High.......is there any else method for comparing the aggregates of 2 waveforms......also How can I incresae a counter every time I get a High or Low depending on the case structure (counter 1 increases if True and Counter 2 increases if False.)
 
Could anybody please suggest how to comapre aggregates of waveforms and Counter increment.
 
With Regards
James
 
 
0 Kudos
Message 1 of 5
(10,736 Views)
when comparing two continoius values such as a float or a waveform simple equality does not work, you must use an epsilon or deviation between the values.  for floats this is just the absolute difference between the numbers.  for waveforms, you should make sure the signals are ligned up in phase and the same sample time and frequency is used then you can get the average deviation between the points. This will give you an indication of the difference between the signals.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 5
(10,721 Views)
Hello Falkpl
 
Thanks for ur reply.....my time axis(i.e. x-axis) will be same for all my waveforms as I have same sampling rate evry time so now how can I compare the Y values for 5% error rate.
 
 
Thanks
0 Kudos
Message 3 of 5
(10,684 Views)

Your comparison is actually working fine in most cases (I very much agree with being careful about comparing floating point numbers). But you're problem in your original code also boils down to the fact that when you divide waveforms, you divide element per element. One of these elements in the denominator was zero, so the output waveform had a NaN in it. When you try to compare the waveform by aggregate against zero, the NaN in the first element of the waveform is causing the problems with your answer. If you change the comparison mode to Compare Elements, this will output an array of booleans. Here you see that the first element was false, but the next few were all true. You will have to account for this somehow.

Jarrod S.
National Instruments
0 Kudos
Message 4 of 5
(10,675 Views)
So, you want to know if the Y values of the signal waveform are within 5% of the Y values (of the same index) of a master waveform?  Provided you can ignore dt and t0 as you have indicated, you can use the in-range/coerce function.  With the standard caveat that compairisions of DBLs that are very close to eachother can yeild odd results.




Message Edited by jasonhill on 07-27-2006 11:24 AM

0 Kudos
Message 5 of 5
(10,674 Views)