-
Notifications
You must be signed in to change notification settings - Fork 65
/
lambplot.m
56 lines (52 loc) · 1.14 KB
/
lambplot.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
%
% LAMBPLOT
% Make some convergence plots
%
% lambplot(emats, ematw, plot);
%
% emats: errors from SW4
% ematw: errors from WPP
% plot: 1,2,...: type of plot
%
function lambplot(emats, ematw, plot)
% get some simulation info
[p dist scpu wcpu msol]=lambtest();
nres=7;
ndist=10;
% line width
lw = 2;
% strarting indices
bres=2;
bdist=1;
clf;
hold on;
if plot == 1
% rel error as func of cpu time
% d = 10;
for d=1:ndist
h=loglog(scpu(bres:nres),emats(bres:nres,d)/msol(d),"b",wcpu(bres:nres),ematw(bres:nres,d)/msol(d),"r");
set(h,"linewidth",lw);
end
elseif plot == 2
% rel error as func of points per wave length
% d = 10;
for d=1:ndist
h=loglog(p(bres:nres),emats(bres:nres,d)/msol(d),"b",p(bres:nres),ematw(bres:nres,d)/msol(d),"r");
set(h,"linewidth",lw);
end
elseif plot == 3
% rel error as func of distance
% r = 7
for r=bres:7
h=semilogy(dist,emats(r,:)./msol(1,:),"b",dist,ematw(r,:)./msol(1,:),"r");
set(h,"linewidth",lw);
end
elseif plot == 4
% abs error as func of distance
% r = 7
for r=bres:7
h=semilogy(dist,emats(r,:),"b",dist,ematw(r,:),"r");
set(h,"linewidth",lw);
end
end
hold off;