-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErr.m
More file actions
37 lines (29 loc) · 960 Bytes
/
Copy pathErr.m
File metadata and controls
37 lines (29 loc) · 960 Bytes
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
function Err
% Çó½âÎó²îºÍÊÕÁ²½×
[T,L,Nt,Nx,dx,dt,sigma1,sigma2,r1,r2,gamma,mu,eps,rho0,A,x0,t0,K] = ParaImput();
Norm = zeros(1,5);
for i = 1:5
x = linspace(-L,L,i*Nx+1);
s = exp(x);
Utr1 = zeros(1,i*Nx+1);
Utr2 = zeros(1,i*Nx+1);
[Upcm1,Upcm2] = DataMatrix(Nt,i*Nx,dx/i,dt,sigma1,sigma2,r1,r2,gamma,mu,eps,rho0,A,x0,t0,K);
Up1 = Upcm1(Nt+1,:);
Up2 = Upcm2(Nt+1,:);
for j = 1:i*Nx+1
Utr1(j) = TTtransfer(K,Nt,s(j),T,r1,r2,sigma1,sigma2,-A);
Utr2(j) = TTtransfer(K,Nt,s(j),T,r1,r2,sigma1,sigma2,-A);
end
intF = 0.5*(Utr1(1:end-1)+Utr1(2:end)-Up1(1:end-1)-Up1(2:end));
Norm(i) = sqrt(intF*intF'*2*L/(Nx*i));
end
N0 = [50 100 150 200 250];
loglog(2*L./N0,Norm,'-+')
% N = [60 70 80 90 100];
% Err1
%
% loglog((2*L)./N,Err1,'-+')
% hold on
% loglog((2*L)./N,Err2,'-+')
%
end