01-07-2009 08:17 AM
I have input rectangle signal with noise. Period T < 10 seconds.
I need to compute dynamically how long time highest and lowest vaues.
Signal changes from highest to lowest and from lowest to highest value immediatelly(<0,05 sec).
01-08-2009 01:50 AM
Code in C-style language:
x(t) - square-formed function
x0 - treshold value
t_beg_min = t_cur;
t_beg_max = t_cur;
FindMax = true;
FindMin = false;
if ((x_cur>x0) and FindMax) {
Time_min = t_cur - t_beg_min; ->OUTPUT
t_beg_max = t_cur;
FindMax = false;
FindMin = true;
}
if ((x_cur<x0) and FindMin) {
Time_max = t_cur - t_beg_may; ->OUTPUT
t_beg_min = t_cur;
FindMax = true;
FindMin = false;
}
01-08-2009 03:42 AM
I found solution:
http://www.labviewforum.de/index.php?showtopic=976&hl=Timingmessung