forked from lydia1895/PMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PMM_T_matrices_new.m
executable file
·75 lines (66 loc) · 1.85 KB
/
PMM_T_matrices_new.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
function [T, aT, U] = PMM_T_matrices_new(Nx,nx,N_basis_x,ax,La,N_intervals_x)
N_total_x = sum(N_basis_x);
N_total_x3 = N_total_x - N_intervals_x;
Nmax = max(N_basis_x);
p = zeros(Nmax,1);
norm = zeros(Nmax,1);
for i=0:(Nmax-1)
p(i+1) = gamma(i+2*La)/(gamma(2*La)*gamma(i+1));
%p(i)=Ci i-th Gegenbauer polynomial at 1
norm(i+1) = pi^0.5*p(i+1)*gamma(La+0.5)/(gamma(La)*(i+La));
%<Cn,Cm> = delta(n,m)*norm(n)
end
hx = zeros(N_total_x3);
for k=1:N_intervals_x
for i=(Nx(k)+1):(Nx(k)+nx(k))
hx(i,i) = norm(i-Nx(k));
end
end
U = zeros(N_intervals_x,N_total_x3,N_total_x3);
T = zeros(N_intervals_x,N_total_x3,N_total_x3);
Tnew = zeros(N_intervals_x,N_total_x3,N_total_x);
aT = zeros(N_intervals_x,N_total_x3,N_total_x3);
for j=1:N_intervals_x
for i=(Nx(j)+1):(Nx(j)+nx(j))
U(j,i,i) = hx(i,i);
end
end
%integral for P 1st basis and P 3d basis
for k=1:N_intervals_x
for m=Nx(k)+1:Nx(k)+nx(k)
for i=Nx(k)+1:Nx(k)+nx(k)
numm = m-Nx(k);
numi = i-Nx(k);
if (numi == numm-1)
L = numm-1;
T(k,m,i) = 2*L/((2*L-1)*(2*L+1));
end
if (numi == numm+1)
L = numm-1;
T(k,m,i) = 2*(L+1)/((2*L+1)*(2*L+3));
end
end
end
end
%integral for P 3d basis and P 3d basis
for k=1:N_intervals_x
for m=Nx(k)+1:Nx(k)+nx(k)
for i=Nx(k)+(k-1)+1:Nx(k)+(k-1)+nx(k)+1
numm = m-Nx(k);
numi = i-Nx(k)-(k-1);
if (numi == numm-1)
L = numm-1;
Tnew(k,m,i) = 2*L/((2*L-1)*(2*L+1));
end
if (numi == numm+1)
L = numm-1;
Tnew(k,m,i) = 2*(L+1)/((2*L+1)*(2*L+3));
end
end
end
end
for i=1:N_intervals_x
TTnew(:,:)=Tnew(i,:,:);
aTT = TTnew*ax;
aT(i,:,:) = aTT;
end