Algorithm to find slope of line with a modulus Say I have some data which represents a single line, and I want to determine its approximate slope. This data has a known minimum and maximum on the y-axis. When the line crosses the maximum, it re-emerges at the minimum, or vice versa, so there appear to be many parallel lines in the data. Clearly, the feasibility of this is dependent on the sampling rate and the amount of noise in the data. Also, a slope too steep will put the apparent parallel lines too close to each other such that they'd become impossible to distinguish. So, we'll assume that the sampling rate, noise, and slope are all within reasonable limits. Is there a particularly elegant way to approach this problem?
As I understand it, the best way should just be to take the known maximum - minimum as your change in y, and the period length as the change in x (assuming the function you've described is periodic, with its domain as ℝ), and their ratio is the slope.  Since you're dealing with discrete points, you'd just need enough data to estimate the shape of two periods to solve for the period length, but more is obviously better.