Building a Signal Model for Samples from a Sensor I have a signal I'm getting from a sensor (shown below in the photo of an excel plot) and I need to process it to get it to look something like the red line I've overdrawn on it.  Sort of a moving average type process that doesn't fall too quickly unless the overall signal is actually falling.

Anyone have any ideas as to what the best method(algo) would be to approach this problem?

Any suggestions on directions I could look towards would be helpful as well, it's been years since I took signal processing in school and I don't remember what methods are even out there that could be tried.

Thanks!

Jonathan
A simple exponential average has the following difference equation:

y(n) = (1-alpha) * x(n) + alpha * y(n-1)

To get a different rise and fall rate, you can dynamically choose alpha depending on whether x(n) is larger than y(n-1). For example, you could build have alpha = 0 when x(n) > y(n-1), and alpha = 0.99 otherwise. This could accomplish the "peak hold" goal, and the second value of alpha would let you control the decay after each peak.