LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help on implementing offset corrector on an integrated waveform

Good afternoon gents, i'm kinda new to Labview programming.

Here's my problem: i'm dealing with integrated waveforms with an offset error due to the integration, in the pictures attached you can see the waveforms and the highlighted part in red should correspond to zero. 

I was wondering on how to correct this and my idea is: identify a segment where the value is more or less constant for a certain amount of time, take that portion of the signal and do the mean value.

Then (depending on the case, if the value of that portion of the signal is positive or negative) add or subtract this mean value to the integrated waveform. 

 

Any suggestions on how to implement this in a labview VI?

Download All
0 Kudos
Message 1 of 5
(2,182 Views)

So you want to find the part of the waveform that is pretty flat, so you can use that to get the value of the flat area and subtract that from the original waveform?

 

My first thought is to take the 1st and 2nd derivative of the original waveform.  Any part of the waveform where both of those are close to zero should be a area of a flat line.

 

The reason for the 2nd derivative is that the 1st derivative will point out where the peaks and valleys of the sine portion are.  The 2nd derivative will show it is actually flat and not the curve up or down at a peak or valley.

0 Kudos
Message 2 of 5
(2,130 Views)

I already have the derivative but i have to work with the integrated waveform.

Basically i want to find the part circled in red through scanning the waveform data, calculate the mean value of a small portion of that part and then subtract/add the mean value to the whole integrated waveform, that's because i know in that part the value should be zero and so i would correct the offset error.

 

My question is how can i scan the whole data of the waveform and put a condition where (given a certain tolerance): if the value remain constant for a certain time then calculate the mean value of that part?

 

Should i use a case structure scanning through the whole array?

0 Kudos
Message 3 of 5
(2,085 Views)

I was thinking on a conditional tunnel mode that compares the value of the waveform array with the index value before of the waveform and so on, if the condition is true (meaning they are more or less equal) for at least 100 values then build an array with those values. Then outside the tunnel calculate the mean value.

 

This is my idea but i'm not so sure on how to implement something like this.

0 Kudos
Message 4 of 5
(2,079 Views)

@BonifacioLupo wrote:

I already have the derivative but i have to work with the integrated waveform.

 


I never said don't work with the original waveform.

You use the 1st and 2nd derivatives of the original waveform to figure out the indices where you want to analyze the data.  You apply those indices to the original waveform.

0 Kudos
Message 5 of 5
(2,053 Views)