Re: Numerical integration of a series
- From: spellucci@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Peter Spellucci)
- Date: Wed, 27 Feb 2008 14:40:11 +0100 (CET)
In article <1aedc6af-5858-4305-8796-a42bdfe5f03f@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Ragu <ssragunath@xxxxxxxxx> writes:
This is my first post in s.m.n forum. I have a set of equally spaced>
acceleration (accel) data points. I need to integrate it to obtain
velocity (vel) and displacement (disp).
NIntegrate[accel(t)] = vel(t)
NIntegrate[vel(t)] = disp(t)
accel(0) = aval1
accel(0+dt) = aval2
accel(0+2*dt) = aval3
accel(0+3*dt) = aval4
.
accel(0+(n-1)*dt) = avaln
I need to integrate this data with respect to t so that I get
vel(0) = vval1
vel(0+dt) = vval2
vel(0+2*dt) = vval3
vel(0+3*dt) = vval4
.
vel(0+(n-1)*dt) = avaln
I would like to get the most accurate solution (or exact solution if
possible). I had used trapezoidal rule (in school) and remember
getting a third order error.
Could someone please suggest me a standard way of performing higher
order integration for the above problem using readily available
routines (either Intel MKL or IMSL libraries)? The standard routines
available for Univariate Quadrature are given for an interval from A
to B. This would mean that I will have to split my data into n
intervals, fit a straight line for each interval and then call the
univariate quadrature subroutine "n" times. For obtaining displacement
from velocity, I will fit a second degree curve for each interval,
then integrate "n" times.
Is this the way to implement a solution for this problem? My feeling
is that there should be other easier / elegant ways, but I am totally
new to numerical analysis domain. Please advice.
Thanks.
first of all, you need to know initial values for vel(0) and disp(0) since
vel'(t0=accel(t) =>
vel(t)=vel(0) + integral_{0 to t } accel(s)ds
and similarly
disp(t)=disp(0) + integral_{0 to t} vel(s)ds
next, how to proceed depends:
either you get the values "aval_i" in your notation in real time
and want to integrate in real time. then doing the integral
step by step using e.g. the trapezoidal rule
with dt=h =step size:
integral_new=integral_old+(h/2)*(new_aval+last_aval)
as a first solution
and if the values "aval_i" are no exact, but have some measurement errors
there will be little sense in using a "better" routine.
In principle you could use, given enough grid points, any useful
formula for equidistent nodes
for example, you could use simpsons rule with an odd number of available
points and the (3/8)-rule (sometimes also called the "pulcherrima", devil knows
why)
what I mean:
integral_{i*dt to (i+2)*dt} = (dt/3)*
( f(i*dt) + 4*f((i+1)*dt)
+f((i+2)*dt) )
or
integral_{i*dt to (i+3)*dt} = (3*dt/8)* (f(i*dt) + 3*f((i+1)*dt)
+ 3*f((i+2)*dt)+f((i+3)*dt) )
these two formulas are exact for polynomials up to order three
and the local error is dt^5
there are formulas of even higher order, but these make little sense if
the number of grid points used goes above 9 ,say.
nevertheless, as said, if your data have even little noise , this is
questionable anyway.
if, on the other side, you have _all_ data available _at once_ , possibly with noise,
then I would compute a smooting spline first and integrate this one exactly
afterwards two times.
finally, you might rely on the ode-solver :
vel(0)= vel_0_given
disp(0) = disp_0_given
vel'(t) = accel(t)
disp'(t) = vel(t)
but this requires you have a code which accepts instead of a function
on the right hand side an input of grid_data (and manages the necessary
interpolation himself)
hth
peter
.
- Follow-Ups:
- Re: Numerical integration of a series
- From: Ragu
- Re: Numerical integration of a series
- References:
- Numerical integration of a series
- From: Ragu
- Numerical integration of a series
- Prev by Date: Biotreatment of Industrial Effluents
- Next by Date: Re: optimization problem -- any pointers?
- Previous by thread: Numerical integration of a series
- Next by thread: Re: Numerical integration of a series
- Index(es):
Relevant Pages
|