LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Max and Min of continuous analog data

Hi,

I am working on a project where I have to record data and find max and min values. Here are the details:

I need to record continuous data from DAQ card and write to a text file with the sampling frequency of 100 Hz. This should be fine for me. I can use while loop and record data. The problem is finding the max and min from continuous data. The signal is sine wave with varying amplitudes. I cannot use the max and min function in each while loop iteration for maximum and minimum as the signal might be high or low for extended period of time. Basically, I need to find max and mins on continuous data and record them. 

Hopefully, someone can help with this. 

 

Thanks

0 Kudos
Message 1 of 10
(5,019 Views)

Do you mean you want a single max and min during the whole data collection? Just store your max and min in a shift register. If the new max is greater than the old max, or the new min is less than the old min, store the new value.

Message 2 of 10
(5,007 Views)

While I went off to create this snippet, gregoryj already gave you the same answer.  Here it is again, visually:

 

 

-Kevin P

 

running max and min.png

 

 

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 10
(5,000 Views)

There is a ptbypt version (min&max ptbypt or similar) that will do exactly what you want. No need for shift register and fancy code.

Message 4 of 10
(4,987 Views)

@altenbach wrote:

There is a ptbypt version (min&max ptbypt or similar) that will do exactly what you want. No need for shift register and fancy code.


Technically, there is a need for shift registers and fancy code but they are already found in the aforementioned prepackaged VI.  Smiley Very Happy

aputman
0 Kudos
Message 5 of 10
(4,978 Views)

... and it contains more features, such as finite and infinite history length, reset, etc. 🙂

0 Kudos
Message 6 of 10
(4,972 Views)

Actually, I want to record every peak and trough of the signal, not just the highest and lowest value. So basically, there will be peak followed by trough and followed by peak and it continues. I want to record all of them. 

the problem with using max and min function is that there might be multiple peaks and troughs in single while loop iteration. But the max and min will only take one from that iteration. 

Also, I thought of using peak detector as well. But as the data might be little noisy, it will records all smaller peaks. I just want highest and lowest point continuously. 

Hopefully this makes things clearer. Sorry for the confusion earlier. 


Thanks

0 Kudos
Message 7 of 10
(4,967 Views)

@manny09 wrote:

Actually, I want to record every peak and trough of the signal, not just the highest and lowest value. So basically, there will be peak followed by trough and followed by peak and it continues. I want to record all of them. 

the problem with using max and min function is that there might be multiple peaks and troughs in single while loop iteration. But the max and min will only take one from that iteration. 

Also, I thought of using peak detector as well. But as the data might be little noisy, it will records all smaller peaks. I just want highest and lowest point continuously. 

Hopefully this makes things clearer. Sorry for the confusion earlier. 


Thanks


Oh, In that case use Peak Detector PtByPt VI


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 10
(4,953 Views)

Thanks all for the help. 

I never got a chance to check it. The project scope changed. 


Thanks

0 Kudos
Message 9 of 10
(4,870 Views)

Oh Manny, don't go bringing the real world into this!

Message 10 of 10
(4,861 Views)