# LabVIEW

cancel
Showing results for
Did you mean:

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

Hi Yum,

@Pukhtun_Yum wrote:

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.

Two simple steps:

2. Take the average of the samples at those locations…

What have you tried so far and where are you stuck?

Best regards,
GerdW

using LV2016/2019/2020 on Win8.1/10+cRIO
Message 11 of 31
(354 Views)

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

I was thinking of the same but these two signals are slightly out of phase. The red signal is the one from chopper and I can control its phase. If i calculate the phase of the white signal (OUTPUT) and set the phase of the red signal accordingly would it work that way ? or are there any other options to conduct ?

Message 12 of 31
(351 Views)

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

Hi Yum,

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.

@Pukhtun_Yum wrote:

If i calculate the phase of the white signal (OUTPUT) and set the phase of the red signal accordingly would it work that way ?

How does the phase difference to another signal come into play here?

All you wanted is:

@Pukhtun_Yum wrote:

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.

Find the min/max locations and calculate an average for each of them…

Best regards,
GerdW

using LV2016/2019/2020 on Win8.1/10+cRIO
Message 13 of 31
(346 Views)

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

The phase difference is due to the time constant of the sensor.

The understood what you mean by taking min max value but can you tell me how would i make the phase of both signals similar ?

Message 14 of 31
(344 Views)

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

Hi Yum,

@Pukhtun_Yum wrote:

The understood what you mean by taking min max value but can you tell me how would i make the phase of both signals similar ?

Still don't understand how the phase difference is connected to finding the min/max of a signal…

You need to shift one signal by an amount of samples to correct the phase "lag" between those two signals.

(Or use the waveform datatype and manipulate its t0 element…)

Best regards,
GerdW

using LV2016/2019/2020 on Win8.1/10+cRIO
Message 15 of 31
(340 Views)

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

How would I know that how much samples will be used to bring both signals in phase ?

Message 16 of 31
(337 Views)

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

Hi Yum,

@Pukhtun_Yum wrote:

How would I know that how much samples will be used to bring both signals in phase ?

You can count them easily when you determine X position of  the chopper signal state transition and the corresponding change in the thermopile sensor signal…

Best regards,
GerdW

using LV2016/2019/2020 on Win8.1/10+cRIO
Message 17 of 31
(316 Views)

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

@Pukhtun_Yum wrote:

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.

You really (really!!) need to stop posting pictures and start attaching actual data so we can try a few things.

Message 18 of 31
(302 Views)

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

I have attached the VI this time. I am getting two signals and they are out of phase, what should i do to make it get in phase ? secondly, I want to take three points at both the maximum and minimum of the wave so that i could take the avverage of all maximum and all minimum to get the accurate amplitude of the white signal (output)

Message 19 of 31
(299 Views)

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

Thanks for the data. I am currently in a meeting and will look at it later.

About the code (quick glance only):

You really don't need xy graphs. because the points are spaced equally. Just set x0 and dx. SIgnificantly simpler data structures!

There are some Rube Goldberg bits, for example the "=TRUE" just returns the input unchanged and can be deleted. You also don't need to wire the index:

Message 20 of 31
(281 Views)