Click here to Skip to main content
15,917,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to find out a simple solution to the following problem:

I have two time series data sets, in terms of discrete points. Now without involving extensive regression mathematics, i need to find out the point of intersection of these two data series. A close approximation would be good enough.

The point of intersection is between the maxima and minima of the time series, i.e. they intersect within the extremities of the dataset.

A solution around Oracle or C#/VB.NET would be ideal.

Thanks,

[Update: a bit of elaboration]
There are two sets of data points:

Set A say:

(0,1),(1,5),(5,11),(10,17),(12,21),(15,25),(20,32),(30,43),(40,41)
and

Set B say:

(4,11),(11,15),(15,21),(20,37),(22,41),(25,55),(30,62),(40,73),(50,81)
(these numbers are just arbitrary, so please excuse if these do not actually intersect, or have more than one intersection points)

In my case, these curves are demand supply lines, which meet at one and only one point. This point of intersection is what i need to find out, with a simple numeric algorithm.

I can provide actual numbers if that helps.

Thanks in advance.
[/Update]
Posted
Updated 16-Feb-11 21:34pm
v3
Comments
Rajesh Anuhya 30-Oct-10 4:57am    
can you explain your question with a simple example????

Hi consider each point pair(vertices) form a edge. In that way construct a list of edges for time series 1 and another list for time series 2

for example the series goes like edge1(pt1,pt2) edge2(pt2,pt3) ....so on one vertex overlap with the previous edge.

Now in a double loop check

[this is a pseudo code]
for each edge1 in edgelist1
for each edge2 in edgelist2
check if edge1 intersect edge2 then break and return those intersection point
end
end

now how to check it intersect or not. By the rule if two edges intersect then the rectangle (bounding space) created by it also intersect. Say for example edge1 (10,10 20,20) edge2 (10,20 30,10). If plotted these edges intersect. Let us prove. Bound rect for edge1 = rect(10,10 20,10 20,20 10,20) and bound rect for edge2= rect(10,20 10,30 30,10 30,20). See both rect has a common point 10,20 so it intersects.

But this is not the case always. There won't be a common point of the rects present instead one corner of the rect will present in the other rects space (that you can find out from if the corner x is between x range of other rect and corner y is between the y range of other rect). If so, then both edges are intersecting. Find the intersection point and return.

hope this give you an idea
 
Share this answer
 
You may:
  • Assume the points of each time series lie on a curve (and the curves have analytical representation: for instance a straight line).
  • Use the method of least squares[^] to find the parameters of the curves.
  • Find (either analytically or numerically) the intersection of the two curves.

:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900