-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfeglqd3.m
62 lines (50 loc) · 1.65 KB
/
feglqd3.m
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
51
52
53
54
55
56
57
58
59
60
61
function [point3,weight3]=feglqd3(nglx,ngly,nglz)
%-------------------------------------------------------------------
% Purpose:
% determine the integration points and weighting coefficients
% of Gauss-Legendre quadrature for three-dimensional integration
%
% Synopsis:
% [point3,weight3]=feglqd3(nglx,ngly,nglz)
%
% Variable Description:
% nglx - number of integration points in the x-axis
% ngly - number of integration points in the y-axis
% nglz - number of integration points in the z-axis
% point3 - vector containing integration points
% weight3 - vector containing weighting coefficients
%-------------------------------------------------------------------
% determine the largest one between nglx and ngly
if nglx > ngly
if nglx > nglz
ngl=nglx;
else
ngl=nglz;
end
else
if ngly > nglz
ngl=ngly;
else
ngl=nglz;
end
end
% initialization
point3=zeros(ngl,3);
weight3=zeros(ngl,3);
% find corresponding integration points and weights
[pointx,weightx]=feglqd1(nglx); % quadrature rule for x-axis
[pointy,weighty]=feglqd1(ngly); % quadrature rule for y-axis
[pointz,weightz]=feglqd1(nglz); % quadrature rule for z-axis
% quadrature for two-dimension
for intx=1:nglx % quadrature in x-axis
point3(intx,1)=pointx(intx);
weight3(intx,1)=weightx(intx);
end
for inty=1:ngly % quadrature in y-axis
point3(inty,2)=pointy(inty);
weight3(inty,2)=weighty(inty);
end
for intz=1:nglz % quadrature in z-axis
point3(intz,3)=pointz(intz);
weight3(intz,3)=weightz(intz);
end