1
$\begingroup$

I came across this example the stream processing chapter of a programming book that I'm reading:

Streams as signals

We began our discussion of streams by describing them as computational analogs of the signals in signal-processing systems. In fact, we can use streams to model signal-processing systems in a very direct way, representing the values of a signal at successive time intervals as consecutive elements of a stream. For instance, we can implement an integrator or summer that, for an input stream $x = (x_i)$, an initial value $C$, and a small increment $\mathrm{d}t$, accumulates the sum

$$S_i = C + \sum_{j=1}^{i} x_j \ \mathrm{d}t$$

and returns the stream of values $S = (S_i)$.

This corresponds to the following signal processing system:

![diagram](https://images.app.goo.gl/69SEhFZ8WXwPKgsL7)

I don't know anything about signal processing, so I'm not sure quite sure how to interpret the formula shown above for finding $S_i$.

At first I thought it was just the approximation of the solution to the definite integral $\int_0^i f(t) \: \mathrm{d}t$, i.e. $\sum_{j=0}^i x_j \, \Delta t$. But then that would mean $C = x_0 \Delta t$, whereas in the Henderson diagram shown above, the initial value $x_0$ is not scaled by anything.

So, what exactly is $C$? And is it correct to think about $S_i$ as an approximation of $\int_0^i f(t) \: \mathrm{d}t$, i.e. $\sum_{j=0}^i x_j \, \Delta t$?

$\endgroup$
17
  • 1
    $\begingroup$ geez i really dislike the mathematical notation quoted in this question. when doing math, formal and proper notation is important. notation can evolve (like O&S did introducing "$x[n]$" to replace "$x_n$" for a discrete sequence), but mixing a discrete summation (with ridiculous limit notation) with the integral differential "$\mathrm{d}t$" is not good. I don't wanna pick on the OP, but that book they are quoting is really promoting and propagating horrible notation. $\endgroup$ Apr 22 at 22:58
  • $\begingroup$ The summation also just doesn’t make any sense. Is there a typo there? $\endgroup$
    – Jdip
    Apr 23 at 2:14
  • $\begingroup$ @Jdip Sorry, I've fixed it. $\endgroup$
    – user51462
    Apr 23 at 2:28
  • 1
    $\begingroup$ well, I think that the authors Harold Abelson and Gerald Jay Sussman have useless and awful taste in mathematical expression. especially for MIT profs. there is no excuse for them. $\endgroup$ Apr 23 at 2:55
  • 1
    $\begingroup$ I understand that I can define symbols to be whatever I want. They're symbols. But notation is used to convey information and ideas to others. And we need some degree of consistency to avoid confusion. Above, the "$\mathrm{d}x$" on the left side of the equation cannot be used in lieu of the "$\Delta x$" on the right-hand side. Now, it confuses no one to use "$h$" instead of "$\Delta x$". But it confuses to use two different meanings for "$\mathrm{d}x$" on both sides of the equal sign. $\endgroup$ Apr 23 at 15:11

2 Answers 2

2
$\begingroup$

Consider a capacitor:

$$\begin{align} v(t) &= \int\limits_{-\infty}^{t} \frac{1}{C} \ i(u) \ \mathrm{d}u \\ \\ &= \int\limits_{-\infty}^{0} \frac{1}{C} \ i(u) \ \mathrm{d}u + \int\limits_{0}^{t} \frac{1}{C} \ i(u) \ \mathrm{d}u \\ \\ &= v(0) + \int\limits_{0}^{t} \frac{1}{C} \ i(u) \ \mathrm{d}u \\ \end{align}$$

The integral at the bottom line has value of zero at $t=0$.

So $v(0)$ is the initial value of the integrator. If $v(0)=0$, then the capacitor is said to be uncharged or "completely relaxed" (using control systems semantic) or having zero initial value at $t=0$.

Now if $v(0) \ne 0$, what we were taught in electrical engineering class was to model that as an uncharged capacitor in series with a battery having voltage of the non-zero $v(0)$. These two are equivalent (the capacitor on the right is uncharged at $t=0$):

enter image description here

Now what does this mean for an integrator with an initial value in signal processing? It means that it's identical to an integrator with zero initial value, but with the output of that integrator always having the initial value added to it. That's how you would code it, if you were representing your integrator as a summation or as a feedback summer.

$\endgroup$
2
  • $\begingroup$ Thank you @robert bristow-johnson, I don't have any knowledge of circuits, but I think this answers my question. In the book, we start the summation at $j=1$ (i.e. $\sum_{j=1}^{i} x_j \: \mathrm{\Delta}t$), is this due to the fact that the integral $\int\limits_{0}^{t} \frac{1}{C} \ i(u) \ \mathrm{d}u$ is $0$ at $t=0$? Is it always $0$ at $t=0$? $\endgroup$
    – user51462
    Apr 23 at 3:02
  • $\begingroup$ Unless it's a dirac delta in the integrad, the integral of any decent function from 0 to 0 has zero width. If there is zero width, the area is zero. $\endgroup$ Apr 23 at 14:43
1
$\begingroup$

C is the initial state. This is describing a discrete time accumulator which is the approximation of a continuous time integrator (as determined by mapping the pole at $s=0$ in the Laplace s-plane to a pole at $z=1$ in the z-Transform z-plane).

An accumulator adds the next incoming value to its state using $y[n]= x[n]+ y[n-1]$, with $y[n]$ representing the new state and $y[n-1]$ the previous state. If we started at 0 and kept inputting 1’s the output would count up by 1, holding it’s last state if we stopped inputs, or set the inputs to 0. If we wanted to start again where we left off, with a new simulation, we would need to set C to the last state where we had left off.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.