I want to find a function for a continous graph that looks like this:
The graph should be linear ($y(x)=c\cdot t$) for some number of units $u_1$, and then constant for a number of units $u_2$ as shown above. It is a cyclic function. For $0<x<u_1$ we have $y(x)=c\cdot x$, for $u_1<x<(u_1+u_2)$ we have $y(x)=y(u_1)$, for $(u_1+u_2)<x<(u_1+u_2+u_1)$ we have $y(x)=c\cdot (x-u_2)$ and so forth. I can kind of see a pattern here, but am unsure how to generalize it. How can I find a neat expression for y? If possible, I hope to arrive at an expression that is not a piecewise function. However, I realize that this might not be possible.
Would using integrals be useful here? Fourier-series (since it is periodic)? I would also be somewhat satisfied with an indirect expression of y (not explicit) .
$$ \int_0^{x'} y(x)\ dx = \int_0^{u_1} y(x)\ dx + y(u_1)[(u_1+u_2)-u_1] + \int_{u_1+u_2}^{u_2+2u_1}y(x)\ dx + y(2u_1+u_2)[u_2] + ... $$
The trend in the constant values can be seen: $y(a)\cdot u_2$ Due to the regular linear increase, $y$ will increase the same amount each interval, so for interval number $j$ we will have $y(u_1)\cdot j \cdot u_2$ for the constant term. The integral for the linear part is the same, only adding a rectangle under it. This height of this rectangle is $y(u_1)\cdot j$. and the width is $u_1$. So then we get:
$$ \int_0^{x'} y(x)\ dx = n\cdot \int_0^{u_1} y(x)\ dx \cdot \left( \sum_{j=0}^{n} y(u_1)\cdot j \cdot u_1 + y(u_1)\cdot j \cdot u_2 \right)+R(x) $$
Where R is the "rest" or leftover part that is not a full cycle. $n$ should be correlated to $x$ in some way? Maybe by some kind of floor function? And then you could take the derivative w/ respect to $x$ on both sides to obtain some expression for $y$? Does this work? How can you take the derivative of a sum when the upper boundary has dependence on $x$?
What bothers me is that I think "this is a simple looking graph, finding its function representation should not be too hard", but it is. I just can't think of a way to express such a function in a simple way...
Any help will be greatly apprechiated. Also feel free to edit in appropriate tags.