LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Onset and offset detection

Hi,

 

I want to detect the on and offset:

Screenshot 2014-04-29 11.28.06.png

of the signal attached in de VI. 

 

I've tried it with a 2nd deritive and then a peak detection, but it just won't work all the time... And sometimes it pick peak, that i don't want because of the noise...

 

Does anyone have a better solution for this problem?

 

Best regards,

Thijs

0 Kudos
Message 1 of 14
(4,517 Views)

From a logical point do the following.

 

For getting the onset,take the values in an array and find the difference between 2 consecutive points. So pick the point where you get more difference and thats your Onset.

 

For getting offset, just take only the data after the Onset and find the difference between 2 consecutive point.,Nnow pick the point where the difference is less and now you got the Offset.

 

Good luck.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 14
(4,484 Views)
Isn't that the same as taking a deritative, and finding it's peak? That's what i'm already doing...
0 Kudos
Message 3 of 14
(4,476 Views)

Any derivative process tends to enhace the noise.

 

Is situations like this it helps to apply any knowledge you have about the cause of the offset. Is that offset always much larger than the changes due to drift, noise, or the desired signal as shown in your image? Do you have all the data shown when you do the analysis or are you trying to detect the offset as it happens? What is the sampling rate? How many samples do you read at a time?

 

If you are doing the analysis after the data is collected, I would look at fitting straight lines to segments of data containing 30-40 time units (x-axis units). In the horizontal sections the slope will be ~1 while in the offset section it will be ~500. If you select the segment lengths short enough that one complete segment is in the high slope section, it would be fairly easy to apply the analytic geometery for the intersection of two straight lines to find the points you marked with X.

 

Lynn

Message 4 of 14
(4,455 Views)

Please downconvert the VI to 2011 and post it.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 14
(4,439 Views)

Here is a version LV 2011

0 Kudos
Message 6 of 14
(4,431 Views)

@johnsold

Here is some more info on the data

 

Samplerate is 512 Hz. 

I already have al the data so it's a detection afterwards.

I can read as many sample at a time as i want...

 

Can you send an example of your fitting technique?

 

Best regards and thanks for the help!

Thijs

 

0 Kudos
Message 7 of 14
(4,428 Views)

Do you mean something like this?

 

Regards,

Thijs

0 Kudos
Message 8 of 14
(4,419 Views)

Hello Thijs,

 

I have had a look at your actual data set in the VI.

There seem to be some spurs (noise?) that are actually bigger than the rising edge you want to detect.

 

Can you indicate on a sceenshot (like the one in attachment) which edges are the ones you want to do your measurements on?

Do you only want to work on the raw data or would you consider doing some "outlier removal" before the processing? (of course you'll then have to first identify outliers)

 

Don't mind the amount ofmarkers on the edges in attachment.

I was just playing around at my side with some cross-product calculation VIs (while taking into acount mean values and standard deviation of my array subsets).

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 9 of 14
(4,377 Views)
Hi Thicop,

I've already figured it out and use a linear fit on the data, see my latest vi, this kills al the noise and gives perfect results. If you have better ideas... very welcome! It is eyemovement data and i only detect within 1000 ms after a stimulus is given, which you don't see here. Then it works great.

What is your method?

Regards,
Thijs
0 Kudos
Message 10 of 14
(4,369 Views)