3

I created a 100hz sine wave in code. When I graph the waveform I get this:

Raw waveform

When I do an integration on this pure sine wave to get a velocity waveform I get:

Integrated waveform

Is this normal? I do not have a math background but I am trying to understand this.

RobC
  • 135
  • 1
    A sinusoid always integrates to a sinusoid -- the "slope" you see is a product of numerical error in your integration method. – David Zhang Sep 22 '14 at 00:21

2 Answers2

4

Your velocity function looks something like $v(t)=-\cos(t)-at+C$. Deriving that to get back to acceleration would give you $a(t)=\sin(t)-a$. If your original acceleration function is exactly centered around the $x$-axis, then $a$ should be $0$ and your velocity function wouldn't slope downwards. Computer precision error?

user137794
  • 2,469
3

Assuming you are applying a numeric integration algorithm to this function, rather than symbolic integration, the "slope" of the result could be due to the way the integration steps are performed, possibly the choice of values of the independent variable at each step. Numeric integration can diverge from the correct answer (and very often will diverge).

It might be possible to say more about this if we know exactly what algorithm was used and exactly what its parameters were.

David K
  • 98,388