Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
numerical integration

Subject: numerical integration

From: JankoZ

Date: 18 Mar, 2013 11:10:23

Message: 1 of 6

Hi I need your help!

I have measurement of acceleration in axis X,Y,Z (cca 6000 measurement with spet 0.02sec). I want to get final position with using Numerical Integration in Matlab. Can anybody help me?

please mail me: jankozavodny@gmail.com

Timestamp Accelerometer-X (mg) Accelerometer-Y (mg) Accelerometer-Z (mg) Gyroscope-X Gyroscope-Y Gyroscope-Z
0 -47 -4 1001 6 7 19
0.02 -49 -7 1001 1 7 20
0.04 -48 -6 998 2 6 17
0.06 -49 -6 1001 4 5 20
0.08 -49 -7 999 7 5 18
0.1 -50 -8 997 4 10 17
0.12 -49 -8 997 8 3 20
0.14 -47 -7 997 2 6 17
0.16 -44 -5 1001 6 9 19
0.18 -51 -6 996 8 8 20
0.2 -49 -6 1001 9 8 18
0.22 -44 -9 998 9 7 20
0.24 -49 -6 993 7 5 19
0.26 -46 -4 998 9 3 17
0.28 -52 -4 995 10 5 21
0.3 -48 -7 1001 4 8 19
0.32 -48 -5 1001 10 4 20
0.34 -53 -4 1000 8 6 19
0.36 -46 -7 1000 8 4 19
0.38 -47 -8 995 8 8 17
0.4 -48 -6 997 3 6 18
0.42 -47 -4 998 7 7 20
0.44 -51 -6 999 6 5 18
0.46 -47 -6 1001 1 5 19

Subject: numerical integration

From: Loren Shure

Date: 18 Mar, 2013 11:45:13

Message: 2 of 6


"JankoZ " <flixo@post.sk> wrote in message
news:ki6smv$26o$1@newscl01ah.mathworks.com...
> Hi I need your help!
>
> I have measurement of acceleration in axis X,Y,Z (cca 6000 measurement
> with spet 0.02sec). I want to get final position with using Numerical
> Integration in Matlab. Can anybody help me?
>
> please mail me: jankozavodny@gmail.com
>
> Timestamp Accelerometer-X (mg) Accelerometer-Y (mg) Accelerometer-Z (mg)
> Gyroscope-X Gyroscope-Y Gyroscope-

<data deleted>

See the help and examples for trapz. But you will have to be careful as you
are going to integrate not only the signal but any noise in the
measurements.

--
--Loren

http://blogs.mathworks.com/loren

Subject: numerical integration

From: Torsten

Date: 18 Mar, 2013 12:12:09

Message: 3 of 6

"JankoZ " <flixo@post.sk> wrote in message <ki6smv$26o$1@newscl01ah.mathworks.com>...
> Hi I need your help!
>
> I have measurement of acceleration in axis X,Y,Z (cca 6000 measurement with spet 0.02sec). I want to get final position with using Numerical Integration in Matlab. Can anybody help me?
>
> please mail me: jankozavodny@gmail.com
>
> Timestamp Accelerometer-X (mg) Accelerometer-Y (mg) Accelerometer-Z (mg) Gyroscope-X Gyroscope-Y Gyroscope-Z
> 0 -47 -4 1001 6 7 19
> 0.02 -49 -7 1001 1 7 20
> 0.04 -48 -6 998 2 6 17
> 0.06 -49 -6 1001 4 5 20
> 0.08 -49 -7 999 7 5 18
> 0.1 -50 -8 997 4 10 17
> 0.12 -49 -8 997 8 3 20
> 0.14 -47 -7 997 2 6 17
> 0.16 -44 -5 1001 6 9 19
> 0.18 -51 -6 996 8 8 20
> 0.2 -49 -6 1001 9 8 18
> 0.22 -44 -9 998 9 7 20
> 0.24 -49 -6 993 7 5 19
> 0.26 -46 -4 998 9 3 17
> 0.28 -52 -4 995 10 5 21
> 0.3 -48 -7 1001 4 8 19
> 0.32 -48 -5 1001 10 4 20
> 0.34 -53 -4 1000 8 6 19
> 0.36 -46 -7 1000 8 4 19
> 0.38 -47 -8 995 8 8 17
> 0.4 -48 -6 997 3 6 18
> 0.42 -47 -4 998 7 7 20
> 0.44 -51 -6 999 6 5 18
> 0.46 -47 -6 1001 1 5 19

This could be of interest for you:
http://www.mathworks.de/matlabcentral/answers/17611

Best wishes
Torsten.

Subject: numerical integration

From: Nasser M. Abbasi

Date: 18 Mar, 2013 14:16:08

Message: 4 of 6

On 3/18/2013 5:10 AM, JankoZ wrote:
> Hi I need your help!
>
> I have measurement of acceleration in axis X,Y,Z (cca 6000 measurement with spet 0.02sec).
>I want to get final position with using Numerical Integration in Matlab. Can anybody help me?

Numerical integration can be hard to get right for this.

Better to do this in frequency domain using FFT.

Take the FFT of acceleration data. Since displacement is integration
2 times in time domain, then in frequency domain it becomes division
by -(n*w1)^2 where w1 is the fundamental frequency of the acceleration
signal (i.e. 2*pi/T) and n is the coefficient (i.e. bin) number.
i.e. n=0..N-1

Then you do ifft on the result.

If you want just velocity, then divide by (I*n*w1) instead and
do the same.

This is what I do. It works well. But if you really want to
do numerical integration, then get the AbraVibe matlab toolbox by
Anders Brandt, it has a well written timeint() function. Apply
it 2 times on your data. (for each x,y,z)

--Nasser

Subject: numerical integration

From: Loren Shure

Date: 20 Mar, 2013 12:54:01

Message: 5 of 6


"Nasser M. Abbasi" <nma@12000.org> wrote in message
news:ki743g$6cg$1@speranza.aioe.org...
> On 3/18/2013 5:10 AM, JankoZ wrote:
>> Hi I need your help!
>>
>> I have measurement of acceleration in axis X,Y,Z (cca 6000 measurement
>> with spet 0.02sec).
>>I want to get final position with using Numerical Integration in Matlab.
>>Can anybody help me?
>
> Numerical integration can be hard to get right for this.
>
> Better to do this in frequency domain using FFT.
>
> Take the FFT of acceleration data. Since displacement is integration
> 2 times in time domain, then in frequency domain it becomes division
> by -(n*w1)^2 where w1 is the fundamental frequency of the acceleration
> signal (i.e. 2*pi/T) and n is the coefficient (i.e. bin) number.
> i.e. n=0..N-1
>
> Then you do ifft on the result.
>
> If you want just velocity, then divide by (I*n*w1) instead and
> do the same.
>
> This is what I do. It works well. But if you really want to
> do numerical integration, then get the AbraVibe matlab toolbox by
> Anders Brandt, it has a well written timeint() function. Apply
> it 2 times on your data. (for each x,y,z)
>
> --Nasser
>


I believe the original data were not evenly sampled, making an FFT (or
filter) solution problematic. Was that just a typo in the data?

--
--Loren

http://blogs.mathworks.com/loren

Subject: numerical integration

From: Nasser M. Abbasi

Date: 20 Mar, 2013 19:39:05

Message: 6 of 6

On 3/20/2013 6:54 AM, Loren Shure wrote:

>
> I believe the original data were not evenly sampled, making an FFT (or
> filter) solution problematic. Was that just a typo in the data?
>

hi;

I have not actually looked at the data. But if it is really not
evenly sampled, then I think you can still do FFT on it. Not
my area at all, but I just did some quick googling on this, and
there are ways to do 'fft' on non-evenly sampled data.

So I think integrating in frequency domain still can be done? Not
sure. We need a DSP expert now to decide, so I'll step out of the
room :)

But you make good observation.

--Nasser

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us