Let $\operatorname{rect}(x)=\chi_{\left[-\frac{1}{2}, \frac{1}{2}\right]}(x)$ be the characteristic function of the interval $\left[-\frac{1}{2}, \frac{1}{2}\right]$ and $\operatorname{rect}^{(p)}(x)=$ rect $* \ldots * \operatorname{rect}(x)$ be the $p$-times iterated convolution of $\operatorname{rect}(x)$. The function $\operatorname{rect}^{(p)}(x)$ is a piecewise polynomial function of degree $p-1$ and a prime example of $B$-spline of order $p-1$.
Given a sequence of data $a_n = \{a_1, a_2, \dots\}$, I want to construct a B-spline of order 0 to interpolate this data. The B-spline of order 0 is essentially a step function, and in my context, it corresponds to the characteristic function of the interval $\left[-\frac{1}{2}, \frac{1}{2}\right]$, denoted as $\operatorname{rect}(x)$.
The B-spline of order 0, in my case, is the characteristic function $\operatorname{rect}(x)$, defined as:
$$ \operatorname{rect}(x) = \begin{cases} 1 & \text{if } -\frac{1}{2} \leq x \leq \frac{1}{2} \\ 0 & \text{otherwise} \end{cases} $$
To interpolate the given sequence $a_n$, I can use the step function $\operatorname{rect}(x)$. The idea is to place a step of height $a_n$ at each corresponding point $x_n$ on the x-axis.
The interpolated function can be expressed as a sum of shifted and scaled step functions:
$$ f(x) = \sum_{n} a_n \cdot \operatorname{rect}\left(\frac{x - x_n}{h}\right) $$
where $h$ is the width of the steps (in my case, $h = 1$ since the interval of $\operatorname{rect}(x)$ is $\left[-\frac{1}{2}, \frac{1}{2}\right]$). In particular, I can choose $x_n=n$ obtaining:
$$ f(x) = \sum_{n} a_n \cdot \operatorname{rect}\left(\frac{x - n}{h}\right) $$
This function $f(x)$ will interpolate the given data sequence $a_n$ using a B-spline of order 0.
For example, if my data sequence is $a_n = \{2, 1, 3\}$, and the corresponding positions on the x-axis are $1, 2, 3$, then the interpolated function would be:
$$ f(x) = 2 \cdot \operatorname{rect}(x - 1) + 1 \cdot \operatorname{rect}(x - 2) + 3 \cdot \operatorname{rect}(x -3) $$
This function will provide a step-wise interpolation of the data using B-spline of order $0$.
Hence, I've been working on interpolating a sequence of data $a_n = \{a_1, a_2, \dots\}$ using a B-spline of order 0, where the B-spline is essentially a step function corresponding to the characteristic function of the interval $\left[-\frac{1}{2}, \frac{1}{2}\right]$.
Now, I am interested in extending this interpolation to a B-spline of order 1. However, I'm finding it challenging to apply the same approach to obtain the interpolation with a B-spline of order 1, as $\operatorname{rect}^2$ would theoretically be a triangle function.
Could anyone guide me on how to construct the function $f(x)$ from the sequence $a_n$ by interpolating it with a B-spline of order 1? The earlier approach involving steps and convolutions seems less straightforward in this case.
I appreciate any insights or alternative methods you may suggest.
Thank you!
If you need a piecewise continuous linear interpolation, then an elementary way to do that is by making
$$ f_k(x_k,y_k,x) = \left(y_k+\frac{y_{k+1}-y_k}{x_{k+1}-x_k}(x-x_k)\right)\left(\theta(x-x_k)-\theta(x-x_{k+1})\right) $$
where $\theta(\cdot)$ is the Heaviside unit step function, and $x_k,y_x$ is the data set to interpolate, and thus
$$ f(x) = \sum_k f_k(x_k,y_k,x) $$
Follows a MATHEMATICA script producing this.