LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Thank you man for your time. 

I will be looking forward to your suggestions as my VI is full of flaws.

0 Kudos
Message 21 of 31
(653 Views)

It would be trivial to find the points of the signal where they cross ~50% of the amplitude (~.34, but since the signal is so steep it does not matter!), then take the inner ~1/3 of each interval and average thos, depending if it is a top or bottom interval.

 

You can also just threshold into the data, the do a low order fit (least absolute residual, second order in the picture) as in the attached simple example. Do piecewise averaging over a handful of peaks each time to record longtime trends.

 

altenbach_0-1597864393828.png

 

0 Kudos
Message 22 of 31
(642 Views)

The solution works perfect but I have one more question. 

The white signal is out of phase from the square wave (chopper), it lags behind the square wave. how can i move the white wave in such a wave that the phase diference between these waves become zero ?

0 Kudos
Message 23 of 31
(623 Views)

Hi Yum,

 


@Pukhtun_Yum wrote:

The white signal is out of phase from the square wave (chopper), it lags behind the square wave. how can i move the white wave in such a wave that the phase diference between these waves become zero ?


You asked this before

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 24 of 31
(620 Views)

Hello, yes I did but i did not come up with the solution of it yet

0 Kudos
Message 25 of 31
(618 Views)

Hi Yum,

 

when you can determine the phase shift then you can shift one of the signals to align them.

You already know how to determine state changes in the choper signal. You can implement a similar algorithm to determine the related state changes in the thermopile signal.

Once you know both positions (aka sample indexes) you can use Rotate1DArray to shift one signal…

 

So what have you tried and where are you stuck?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 26 of 31
(615 Views)

The phase shift fluctuates and how to use phase shift in rotating the 1d array 

0 Kudos
Message 27 of 31
(611 Views)

Your VI makes absolutely no sense.

 

You can only "phase shift" by rotating an array if it contains an integer number of periods for all frequencies. This is not the case with your data. Just find the location if the first transition halfway between the low and high points, then shift one of the data and discard whatever does not contain data from both. 

 

Of course if the delay is an exactly known and invariant instrumental quality, you can just delay one trace by the correct number of points.

0 Kudos
Message 28 of 31
(569 Views)

This is how i did, can you please take a look

0 Kudos
Message 29 of 31
(561 Views)

@Pukhtun_Yum wrote:

This is how i did, can you please take a look


This will not work for the general case because half the amplitude is only at the midpoint if the lower parts are close to zero. (e.g. if you data would go from -5 to 0, the amplitude is 5 but the data never reaches 2.5). Your code also fails the the data e.g. starts at a valley. You need to test for all possible inputs (one starts at low, one at high, both at high, both at low, etc.). Add some code where you can arbitrarily rotate each trace before sending it to your alignment!

 

Here's my quick attempt. Modify as needed depending on which part you want to shift. Also note that the shift might not be integer, so a better solution would remap the data using interpolation. (not shown)

 

 

0 Kudos
Message 30 of 31
(538 Views)