Fitting Continuous Piecewise Linear Functions

Continuous piecewise linear functions (CPWL) are an interesting class of functions. The attractive features include their efficiency and continuity. The CPWL function regression can be better behaving than the polynomial regression, and is often used for approximation of complex functions. The CPWL functions are quite efficient in terms of the computational and memory requirements, which allows demanding applications, such as resource-constrained microcontrollers or graphics processing.

However, there seems to be a lack of methods of fitting the CPWL functions to other functions or experimental sets of data. In particular, when the x coordinates of the CPWL function segments are fixed and only the y coordinates are unknown. The following paper offers a solution to this problem.

The paper describes an application of the least-squares method to fitting a continuous piecewise linear function. It shows that the solution is unique and the best fit can be found without resorting to iterative optimization techniques.

MATLAB Implementation