blob: 5e2a7728a5f9335febc4b3532e965a3b701b80d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//SCI2C: DEFAULT_PRECISION= DOUBLE
function mainfunction()
// ---------------------------------------
// --- Initialization of the parameters. ---
// ---------------------------------------
// ---------------------------------------
// --- Set number of point for quadrature .
// --- interval for quadrature [a,b]
// ---------------------------------------
Np =10 // number of point for quadrature
a=1
b=5
// ---------------------------------------
// --- Compute Legendre-Gauss-Lobatto nodes, weights
//. ---In standard [-1 1] interval
// ---------------------------------------
[x,w]=lglnodes(Np);
disp('x');
disp(x);
disp('w');
disp(w);
// ---------------------------------------
// --- Compute the nodes
//. ---In [a,b] pick a t points in the
// --- desired interval
// -------------------------------------
t=((b-a)./2)*x+(b+a)./2;
Iab=((b-a)./2)*mysum(w.*Fint(t),11);
disp('Number of nodes for quadrature ');
disp(Np)
disp('Integral value in [a b] with Np points');
disp(Iab)
endfunction
|