I have a data set that appears to be made up of two linear regions, separated by what best looks like a sine wave.

I know the x and y co-ordinates of the two points at the end of each line segment, x1, x2, y1, y2, and the respective gradient of the lines, m1 and m2.

I believe I can parameterise a sine wave of the form "y = Asin(Bx+C)+D" so that it passes through the given points, with the same gradient, but can't work out how to solve for the parameters.

Does anybody have any ideas?

Thanks!