Showing results for 
Search instead for 
Did you mean: 

Taking 1st maxmin 2nd maxmin & 3rd maxmin from 1d array.

hello !

I have a signal which is a bit noisy at the high and low state. I want to calculate accurate amplitude by taking 3 to 4 max points and 3 to 4 min points to take average of each and find amplitude. 

What could be the best way out ?

I have attached a picture of the signal 

0 Kudos
Message 1 of 31

Hi Yum,


sort the array containing the plot data. Then take the largest/last 4 elements and the smallest/first 4 elements and average them…

Best regards,

using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 2 of 31

You've just attached a picture of a graph.  How is the data actually stored?


A 1D array?

An array of X,Y values?

A waveform?

Dynamic data?


Are you doing this just for one iteration of high and low points or will it repeat continually?

0 Kudos
Message 3 of 31

@Pukhtun_Yum wrote:

I have a signal which is a bit noisy at the high and low state.

I really doubt that the noise is different at the peaks. It's just easier to see there. Is the signal always in the same general shape (looks like a sine with a few simple harmonics)? Is this a part of a continuous signal with many periods or are you analyzing exactly one period as shown? Does the amplitude change over time and are you trying to follow that change?


Where is the data coming from and what does it represent? Can you attach a few sets of example data?

0 Kudos
Message 4 of 31

The sinal is the output from a sensor and it is being chopped by a optical chopper. Yes it is the part of contineous signal and i am analyzing just one period of it. What I am following is I will increase the chopper frequency with every iteration (say from 4hz to 8hz and so on untill 200hz) and se the decreasing amplitude with increasimng chopper frequency. I tried to use built in vi for amplitude but it is not giving out correct amplitudes. 


0 Kudos
Message 5 of 31

Once you know the size of the noise, you might get close by just taking the local min&max difference and subtracting the noise amplitude.


What is the "built-in vi for amplitude"? can you be more specific?


Again, can you attach a series of typical data?

0 Kudos
Message 6 of 31

Hi Christian,


here is a dataset available…

Best regards,

using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 7 of 31

This is the response signal and i want to take more than one maximum and minmum points 

0 Kudos
Message 8 of 31

@Pukhtun_Yum wrote:

This is the response signal ...

No, this is just a blurry picture of a response signal!

0 Kudos
Message 9 of 31

Hello, sorry i could not reply in time yesterday because i had to leave.

So, as i said that I am getting a signal from data acquistion NI-USB, basically there are two signals through two channels one is the signal that i am getting from optical chopper (square wave) and another one is the signal from thermopile sensor. 

The signal from the thermopile is what I am working on, this signal is a contineous signal having 1000 sample rate and a 1000 number of samples. 

What I want is to take the average of some 3 max points and 3 min points at every high and low locations on the signal. 

0 Kudos
Message 10 of 31