<< CL_gcd Math CL_interpLagrange >>

CelestLab >> Math > CL_integrate

CL_integrate

Integration of a function defined by a data series

Calling Sequence

[y,ydot] = CL_integrate(x,ydotn [,yini, meth, n])

Description

Parameters

x:

Abscissae (in strictly increasing order) (1xN or PxN)

ydotn:

Values of nth derivative at abscissae x (1xN or PxN)

yini:

(optional) Initial conditions for y (y0 or [y0, ydot0]). Default is 0. (1xn or Pxn)

meth:

(string, optional) Integration method: "step_l", "step_m", "lin", "sl4", "sspl", "bl6". Default is "lin". (1x1)

n:

(integer, optional) Integration order (= number of successive integrations): 1 or 2. Default is 1. (1x1)

y:

Integrated values (after n successive integrations) at abscissae x (PxN)

ydot:

First derivatives of y at abscissae x ([] if n == 1) (PxM)

Authors

Examples

// Example 1: Simple integration
x = linspace(0,2*%pi,100);
ydot = cos(x);
yini = 0;
y1 = CL_integrate(x, ydot, yini, meth="lin");
disp(max(abs(y1-sin(x))));
y2 = CL_integrate(x, ydot, yini, meth="sl4");
disp(max(abs(y2-sin(x))));
y3 = CL_integrate(x, ydot, yini, meth="sspl");
disp(max(abs(y3-sin(x))));
y4 = CL_integrate(x, ydot, yini, meth="bl6");
disp(max(abs(y4-sin(x))));

// Example 2: Double integration (step method)
x = linspace(0,2*%pi,100);
ydot2 = cos(x);
yini = [1, 2];
[y, ydot] = CL_integrate(x, ydot2, yini, meth="step_m", n=2);
ydotref = sin(x) + 2;
disp(max(abs(ydot-ydotref)));
yref = -cos(x) + 2*x + 2;
disp(max(abs(y-yref)));

Report an issue
<< CL_gcd Math CL_interpLagrange >>