-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathempty_space_function.m~
More file actions
45 lines (37 loc) · 1.01 KB
/
empty_space_function.m~
File metadata and controls
45 lines (37 loc) · 1.01 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
%% F(r) integration
% SobolPoints
N = 2^11; % Number of points to sum over to estimate inner integral
P = sobolset(2); % set dimension
%% Integrate
r = 0:0.1:2.5;
%r = (0.1:0.1:2).*1000;
F = zeros(length(r),1);
Fc = zeros(length(r),1);
Fin = zeros(length(r),1);
% The smaller num_integrals, more larger integral_result
% num_integrals>12 -> integral_result = 0
% increasing
num_integrals = 128;
% calculate F(r)
parfor i =1:length(r)
X_full = net(P,N);
% Outer most summation
for n=1:num_integrals
% Calculate front constant
c = (-1)^(n-1)*(2*r(i))^(2*n)/factorial(n);
if isnan(c)
disp('NAN');
end
% Integrals summation
integral_result = InnerIntegral(r(i), N, X_full, n);
%integral_result = 1;
F(i) = F(i) + c*integral_result;
Fc(i) = Fc(i) + c;
Fin(i) = Fin(i) + integral_result;
fprintf('n = %d\n',n);
end
end
figure(1);plot(r,F);
%axis([0 2.5 0 2]);
figure(2);plot(r,Fc);
figure(3);plot(r,Fin);