Quantcast
Channel: Active questions tagged real-analysis - Mathematics Stack Exchange
Viewing all articles
Browse latest Browse all 9285

Approximate piecewise constant function with continuous function

$
0
0

I have a function $f(t)$ that is piecewise constant:$$f(t) = a_i \forall t\in[t_i,t_{i+1})$$with $n$ values $a_0, a_1, ..., a_{n-1}$, and $n+1$ values $t_0, t_1, ..., t_n$.

I want to approximate this function with a function $g(t)$ that is continuous, with the condition that the average of $g(t)$ equals that of $f(t)$ in each piece:$$\int_{t_i}^{t_{i+1}}g(t) dt = a_i\cdot(t_{i+1}-t_i)$$

In addition, I'd like $g$ to have no structure (oscillations) at a timescale below that of the individual pieces. For example: if $a_{i-1} < a_i < a_{i+1}$, I'd like $g$ to have no extremes in $t \in[t_i,t_{i+1})$.

The function $g(t)$ may be a piecewise function (i.e., existing as a different equation in each piece, and not necessarily differentiable in the $t$-values $t_0, t_i, ...$).

I can imagine several ways of doing this, but before I reinvent the wheel, I thought I'd ask here if there is a 'common' way to do this. I find many ways to do the reverse, but maybe I'm not using the correct search terms, as I don't know what the mathematical term for this process is.


EDIT

I've added some initial implementations as an answer to this question.

However, what I think would be the best way of getting a good function $g$, is using a physical analogue; but I've started a seperate question for that here.


Viewing all articles
Browse latest Browse all 9285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>