# [SciPy-User] Res: cumtrapz

Paulo Jabardo pjabardo@yahoo.com...
Thu Nov 4 10:05:57 CDT 2010

The best way to integrate an accelaration signal is to use the fft. But you have
to watch out: low frequency noise gets amplified so it is *essential* that you
use a high-pass filter on the signal.

I'm writing a small library with a few signal processing functions that
implement exactly what you want:

http://bitbucket.org/pjabardo/pysignal

The functions you want are in filt.py - hpfilt and fseries - integral tha
integrates/derivates a signal using FFT.

Example:
a = ...

import pysignal

af = pysignal.hpfilt(a, 0.05, 1)    #1 - Sampling frequency, 0.05 - filter

x = pysignal.integral(af, 2)   # 2 - Integrate 2 times, negative numbers -
derivatives.

I hope this helps.

----- Mensagem original ----
De: Nils Wagner <nwagner@iam.uni-stuttgart.de>
Para: SciPy Users List <scipy-user@scipy.org>
Enviadas: Quinta-feira, 4 de Novembro de 2010 11:29:21
Assunto: Re: [SciPy-User] cumtrapz

On Thu, 4 Nov 2010 08:20:27 -0500
Ryan May <rmay31@gmail.com> wrote:
> On Thu, Nov 4, 2010 at 3:42 AM, Nils Wagner
> <nwagner@iam.uni-stuttgart.de> wrote:
>> Hi all,
>>
>> cumtrapz can be used to compute the antiderivative.
>>
>> x = linspace(0,2*pi,200)
>> y = 2*cos(2*x)
>> Y = cumtrapz(y,x)
>>
>>
>>
>> len(y) = 200
>> len(Y) = 199
>>
>> The length of the arrays y and Y differ by one. For what
>> reason ?
>
> Because when integrating using the trapezoid rule, you
>are forming N-1
> trapezoids from N datapoints.
>
> Ryan
>
> --
> Ryan May
> School of Meteorology
> University of Oklahoma
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

Hi Ryan,

is there an integration rule in scipy that preserves the
length of the input array ?

I would to integrate an acceleration signal twice to
obtain the displacement.

v = \int a dt = \int dv
u = \int v dt  = \int du

Nils
_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user