-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.m
92 lines (77 loc) · 2.07 KB
/
demo.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
76
77
78
79
80
81
82
83
84
85
86
87
88
% unit disk
N = 128;
theta = linspace(0, 2*pi, N);
theta = theta(1:(N-1));
nodes = [cos(theta); sin(theta)];
femm_opt = struct('deg', 2, 'qdeg', 6, 'min_area', 1e-2, 'edge', nodes);
opt = struct('femm_opt', femm_opt, 'omega', 20, 'kappa', 2.0);
obj = otpat(opt);
[obj.measurement, ~, ~, ~, ~] = obj.forward(obj.parameter, 0.0);
%%
tic;
obj.reg = struct('d' , 1e-2, 'a', 1e-4, 'g', 1e-6);
[res, hist] = obj.backward();
toc;
%%
m = 3; n = 4; order = 0;
set(gcf, 'Position', [100, 100, 1600, 800])
order = order + 1;
subplot(m, n, order);
obj.vis(obj.parameter.d);
title('exact D');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(obj.parameter.a);
title('exact \sigma');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(obj.parameter.g);
title('exact Gruneisen');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(obj.parameter.d./(obj.parameter.a .* obj.parameter.g).^2);
title('exact \chi');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(1:obj.cache.n));
title('recovered D');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(obj.cache.n+1:2*obj.cache.n));
title('recovered \sigma');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(2*obj.cache.n+1:3*obj.cache.n));
title('recovered Gruneisen');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(1:obj.cache.n)./(res(obj.cache.n+1:2*obj.cache.n) .* res(2*obj.cache.n+1:3*obj.cache.n)).^2);
title('recovered \chi');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(1:obj.cache.n) - obj.parameter.d);
title('error of D');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(obj.cache.n+1:2*obj.cache.n) - obj.parameter.a);
title('error of \sigma');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(2*obj.cache.n+1:3*obj.cache.n) - obj.parameter.g);
title('error of Gruneisen');
axis off;
order = order + 1;
subplot(m, n, order);
obj.vis(res(1:obj.cache.n)./(res(obj.cache.n+1:2*obj.cache.n) .* res(2*obj.cache.n+1:3*obj.cache.n)).^2 - obj.parameter.d./(obj.parameter.a.*obj.parameter.g).^2);
title('error of \chi');
axis off;