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.
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.