-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.m
More file actions
32 lines (26 loc) · 1.11 KB
/
Copy pathexample.m
File metadata and controls
32 lines (26 loc) · 1.11 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
% Example script
format long
% Computes weights and nodes of TAME with N=10 points; use a circle of radius 1 as domain
n=10; r=1;
tame_method = AAAweights(n,'Zshape','circle','r',r);
% Eliminate conjugate nodes, to use only N'=5 evaluations
tame_method = cleanup_conjugates(tame_method)
% f(t) = exp(-t) has Laplace Transform g(s) = 1/(s+1)
% Inverse Laplace transform of g(s), evaluated in t=1
t = 1
% exact value
fprintf('exact = %.15f\n', exp(-t))
% ans = 0.367879441171442
fprintf('tame = %.15f\n\n', ilt(@(s) 1/(s+1), t, tame_method))
% ans = 0.367879441171413
% Comparison with other methods
euler_method = ILTweights(5,'euler');
fprintf('euler = %.15f\n', ilt(@(s) 1/(s+1), t, euler_method))
gaver_method = ILTweights(6,'gaver');
fprintf('gaver = %.15f\n', ilt(@(s) 1/(s+1), t, gaver_method))
talbot_method = ILTweights(5,'talbot');
fprintf('talbot = %.15f\n', ilt(@(s) 1/(s+1), t, talbot_method))
cme_method = ILTweights(5,'cme');
fprintf('cme = %.15f\n', ilt(@(s) 1/(s+1), t, cme_method))
zakian_method = ILTweights(4,'zakian');
fprintf('zakian = %.15f\n', ilt(@(s) 1/(s+1), t, zakian_method))