-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGaussQuadrature.m
More file actions
50 lines (43 loc) · 1.79 KB
/
GaussQuadrature.m
File metadata and controls
50 lines (43 loc) · 1.79 KB
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
50
function [Gausspoint,Gaussweight] = GaussQuadrature(order)
%-------------------------------------------------------------------
% Purpose:
% Determine the integration points and weighting coefficients
% of Gauss-Legendre quadrature
%
% Synopsis:
% [point,weight]=GaussQuadrature(order)
%
% Variable Description:
% order - order of the Gaussian integration
% Gausspoint - matrix containing integration points
% Gaussweight - vector containing weighting coefficients
%-------------------------------------------------------------------
switch order
case 'third'
% corresponding integration points and weights
% 3-point quadrature rule
Gausspoint = [-sqrt(3/5) -sqrt(3/5);
0 -sqrt(3/5);
sqrt(3/5) -sqrt(3/5);
-sqrt(3/5) 0;
0 0;
sqrt(3/5) 0;
-sqrt(3/5) sqrt(3/5);
0 sqrt(3/5);
sqrt(3/5) sqrt(3/5)
] ;
Gaussweight = [25/81 ;40/81 ;25/81 ; 40/81 ; 64/81 ; 40/81 ; 25/81; 40/81; 25/81];
case 'second'
% corresponding integration points and weights
% 2-point quadrature rule
Gausspoint = [-0.577350269189626 -0.577350269189626;
0.577350269189626 -0.577350269189626;
0.577350269189626 0.577350269189626;
-0.577350269189626 0.577350269189626] ;
Gaussweight = [1 ;1;1; 1];
case 'first'
% Corresponding integration points and weigts
% 1-point quadrature eule
Gausspoint = [0 0] ;
Gaussweight = [4] ;
end