Each rising/falling half interval is .5a long. So. we want H(x-0)*(2*U/a)x-2(H(x-.5a)*(2*U/a)x+2H(x-a)*(2*U/a)x-... This way the second heaviside function cancels the first when it comes into action at x=.5a, and the third cancels the second when it comes into action at x=a, etc. The U/(.5a) is the slope of the line y = U/(.5a)*x+b. Basically we want the slope to always have the value of either U/(.5a) or -U/(.5a). So if the slope before X=k is U/(.5a), then we have to subtract 2(U/(.5a)) to get a slope of -U/(.5a). For convenience, I wrote U/(.5a)=2(U/a) in the following discussion
So this would be written (2*U/a)*x + ∑ 2*(-1)^(i+1)*H(x-(.5i*a-.5a))*(2*U/a)*x
Where the summation is from i=2 to infinity
(or if the picture isn't supposed to imply that the function works for all x, then from i=2 to n, where n is the number of ups+downs there are total, so I guess 7 in this case. But then we would have to add to the summation one last function in order to cancel out the 8th heaviside function. So we would just + H(x-(.5*9*a-.5a))*(U/a)*x*(-1)^(i+1) )
This would work assuming that the heaviside function H(x-k) makes the function equal to 1 when x>= k. But if not, then oops, I forgot what the Heaviside function is.
Edit: fixed.