Optimal non-uniform, piecewise interpolation using a given number of points

92 Views Asked by At

I have a given function $y=f(x)$, blue line in this plot:

enter image description here

In a given interval $[x_a,x_b]$, I'd like to approximate this function with a piecewise linear function with non-uniform sampling points and a number of $N$ sampling points (red curve).

I think this is an optimization problem I am looking at:

$$ \min_{x_1,\cdots,X_N} \sum_{n=1}^{N-1} \int_{x_n}^{x_{n+1}} y(x)\,\operatorname{d}x - \left( x_{n+1} - x_n \right) \frac{y(x_n) + y(x_{n+1})}{2} $$

Is there an easy/straight forward way to obtain $x_1\,cdots,x_N$ if $y$, $x_a$, $x_b$ and $N$ are known?

1

There are 1 best solutions below

0
On

If you have a given finite set of candidate points on the curve, you can optimally select an $N$-subset by using dynamic programming. The states are $(x_k,m)$, where $x_k$ is a candidate $x$ coordinate and $m\le N$ is the number of points remaining to be chosen.