Click to See Complete Forum and Search --> : how to determine a threshold value


sonicstaars
April 22nd, 2003, 07:35 PM
Hi everyone,

I have been trying to come up with an algorithm to determine the threshold value of the following scenario:

y-axis
|
| B1 B2 B3
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
|__ |__|_ |__|______________ _|__|____________x-axis (time)
s1 e1 s2 e2 s3 e3

Looking at the above diagram, s1, s2, and s3 represents the start time of each of the respective blocks, labeled as B1, B2, and B3 respectively.

e1, e2, and e3 represents the end time of each of the respective blocks, labeled as B1, B2, and B3 respectively.

I am able to determine the values of s1, s2, and s3. However, the values of e1, e2, and e3 is indeterminate.

My objective is to determine the average value of each of the blocks, labeled as B1, B2, and B3. In the above diagram, I drew them as if they are of the same size. In actual case, they may not be of the same size. The alogorithm to determine the average value is to get the y-axis value of the end time of the block, minus the y-axis value of the start time of the corresponding block, and divided by the difference between the end time and the start time.
In essence,

average value of each block
= ((y-axis value of the end time of the block) - (y-axis value of the start time of the corresponding block)) / (end time of the block - start time of the block)

However, the end time of each of the block is not able to be determined.
Therefore, the work-around is to use the start time of the next block as the end time of the preceding block. This is possible because in my case, there are instances where the blocks will be very close to each other, therefore the margin of error in using the start time of the next block as the end time of the preceding block can be tolerated.

The problem comes in the cases where, after a period of time where the blocks are very close to each other, there will be a lapse, and it will be a long time before the next block appears, as illustrated in the diagram above between block B3 and block B2. In this case, the average value will be pulled very low by the huge time difference.

I am thinking of implementing a threshold value in the time aspects, whereby if the difference between the start time of two consecutive blocks is greater then the threhold, then there will be an indication to the user of the software that the average value calculated for this instance will be a bit skewed.

The problem is I could not think of an algorithm or method to determine the threshold value to implement. I hope someone could give me an idea on how I should go about this, or if anyone feels that there is another way other than implementing the threshold method, please feel free to tell me too. Many grateful thanks in advance.

sonicstaars
April 23rd, 2003, 07:38 PM
Hi everyone,

I understand that it might be a bit too lengthy for understanding. Therefore in order to impart an easier understanding, I would like to re-phrase my question and hope that someone can help me. Many grateful thanks in advance.

Let us assume that a runner is running varying distances every time he starts to run.
My objective is to determine the instantaneous speed of the runner, and the parameters that I am able to determine are only
1. the distance that he is going to run,
2. the start time when he started to run that particular distance.

In order to determine the speed, we should get the distance he ran, divided by the time taken. However, I do not know his ending time and I only know the distance he ran and the start time.

Another information that I know is that he will be running frequently. This is just like bursts of data being transferred. He will run, and then stop for a while and run again. Every time he start to run, I will know his start time and the distance that he is going to run, but I do not know his end time.

The distance that he is going to run everytime will be varying. I do not know how long he is going to stop in between his burst of running too.

With only the above information, my objective is to determine the instantaneous speed of the runner, just like the speedometer in our car. However, this determination of the instantaneous speed of the runner need not be exactly very accurate because of the lack of information of the ending time. I am trying to write a software, which will give a very close, no need to be exact, value of the instantaneous speed of the runner.

I hope someone could give me an idea or any suggestions to help me in this.

Many gratful thanks in advance.