-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcpmlPerformanceTest.m
50 lines (47 loc) · 1.2 KB
/
cpmlPerformanceTest.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
%
% Test Performance of cpml
%
clear;
%% reference computing
zZoneSize=60;
tZoneSize=30;
fdtd1dCPML;
aEx=cEx;
save refRes aEx;
%% reflect computing
zZoneSize=10;
tZoneSize=30;
fdtd1dCPML;
%% performance analysis
t=(1:totalTimeStep)*dt;
load refRes aEx;
relativeError=abs(cEx-aEx)/max(abs(aEx));
dbError=20*log10(relativeError);
% comparision of Ex in time
figure('NumberTitle','OFF','Name','Time Macthing');
plot(t/1e-9,aEx,t/1e-9,cEx,'--','LineWidth',2);
xlabel('time (ns)');
ylabel('Ez');
grid on;
title('time domain compare');
legend('analysis','cpml');
%print -depsc -tiff -r300 cpml1dTimeCompare_r
%print -dtiff -r300 cpml1dTimeCompare_r
% Relative Error
figure('NumberTitle','OFF','Name','Relative Error');
semilogy(t/1e-9,relativeError,'LineWidth',2);
xlabel('time (ns)');
ylabel('Relative Error');
grid on;
title('Relative Error');
%print -depsc -tiff -r300 cpml1dRelativeError_r
%print -dtiff -r300 cpml1dRelativeError_r
% Error in DB
figure('NumberTitle','OFF','Name','DB Error');
plot(t/1e-9,dbError,'LineWidth',2);
xlabel('time (ns)');
ylabel('Error (DB)');
grid on;
title('DB Error');
%print -depsc -tiff -r300 cpml1dDBError_r
%print -dtiff -r300 cpml1dDBError_r