2

Imagine a black box which accepts a digital input signal which is a pure sine wave and outputs the area between this input signal and some constant data set over a sample window.

diagram

Given the input and output signals, is it possible to determine the sample data set?

Edit: Here is how the box calculates area between two data points...

    private double areaBetween(double a, double b)
    {
        if (Math.Sign(a) == Math.Sign(b))
        {
            if (Math.Abs(a) > Math.Abs(b))
                return a - b;
            else
                return b - a;
        }
        else
        {
            return a + b;
        }
    }
  • It appears you are outputting the signed area. In the figure, it looks like the areas above and below the green curve are equal and the output is zero. Is that correct? Also, am I given the length of the sample window? – Ross Millikan Mar 07 '13 at 21:32
  • If it is possible to determine without knowing the window length, this would be preferable. – Madison Brown Mar 07 '13 at 21:38
  • Area which lies above the x-axis is considered positive, and negative if it lies below. – Madison Brown Mar 08 '13 at 01:33

1 Answers1

3

Since integrals are additive, your output is really just the integral of the green input signal over the sample window, minus the integral of the blue sample signal over the same sample window.

The blue integral is constant, and is the only way the sample signal influences your output. So all you can learn about the blue signal from observing the black-box relation between the green and red signals is what the average value of the blue signal is -- that is, in this case, $0$.

(On the other hand, this is also all you need to reconstruct the behavior of the black box for a different input signal, if that is what you're ultimately interested in).

  • Well done. I was trying to make this into Fourier analysis but was just seeing we need the output to be the product of the two curves for that. – Ross Millikan Mar 07 '13 at 21:47
  • The integral of both the green and blue signal is zero over the window at any given time (in the case of the diagram), however the output is not 0, it is a sawtooth wave. Don't the intersections between the two functions complicate your explanation? – Madison Brown Mar 07 '13 at 21:57
  • @MadisonBrown: Your example output doesn't look very sawtoothy. But neither does it look like what you ought to be getting as far as I understand your description -- so I may be misunderstanding something. Is it perhaps a result of integrating over only some of the sample window at the beginning, rather than extending the green signal with zeroes to the left of its starting point? – hmakholm left over Monica Mar 07 '13 at 22:02
  • http://i45.tinypic.com/2lxxms4.png here is a screenshot of the application i created to test this. The input signal is a sinewive. the sample function is a square wave. the window is 16 samples long. the output is seen in the blue window. – Madison Brown Mar 07 '13 at 22:08
  • My understanding is that the area between two curves is equal to the difference between their integrals only if the two curves do not intersect over the range you are calculating. Is this wrong? – Madison Brown Mar 07 '13 at 22:09
  • @MadisonBrown: If the area is signed, as you answered ti Ross, then intersections should not matter. For each sample you add $\mathit{green}-\mathit{blue}$ to the running total; that is the same as first adding all of the greens and then subtracting the sum of all the blues. – hmakholm left over Monica Mar 08 '13 at 00:44
  • Ah I see. It is not signed then. However, the area is positive if it lies above the x-axis and negative if it lies below. I've edited that comment. – Madison Brown Mar 08 '13 at 01:31