Download presentation
Presentation is loading. Please wait.
Published byΤιμόθεος Ζάππας Modified over 5 years ago
1
Stability function h = 0.7 h = 0.3 Model Problem Exact solution
Use Euler method with h = 0.7 and h = 0.3 h = 0.7 clear a = 0; b = 4; n = 20; y0 = 1; f = inline('-(3).*y','x','y'); exact = inline('exp(-(3).*x)'); %% h = 0.7; x = a:h:b; y(1) = y0; ex(1) = y0; %% Euler steps for i=1:length(x)-1 y(i+1) = y(i) + h * f(x(i),y(i)); ex(i+1) = exact(x(i+1)); end plot(x,y,'-ob',x,ex,'-*r'); grid on legend('euler','exact'); xlabel('x'); ylabel('y'); h = 0.3
2
Stability function Model Problem Explicit Euler Method Exact solution
To study the stability of a method, you need to apply your method to this model problem Exact solution this stability region is the disc with centre at −1 and radius 1.
3
Stability function for RK
Sx1 vector Sx1 vector ones vector Size of what Size of what
4
Stability function for RK
5
Explicit Runge–Kutta method
Stability function for RK Explicit Runge–Kutta method Geometric series the order condition
6
Stability function for RK
clear % RK41 b=[1/6;1/3;1/3; 1/6]; c=[0;1/2; 1/2;1]; A=[ ;1/ ;0 1/2 0 0; ]; % % R(z) = 1 + z b^T ( I - z A )^(-1) 1 format rat r2 = b'*A^0*c, r3 = b'*A^1*c, r4 = b'*A^2*c r5 = b'*A^3*c, r6 = b'*A^4*c, r7 = b'*A^5*c r8 = b'*A^6*c r2 = 1/2 r3 = 1/6 r4 = 1/24 r5 = 0 r6 = 0 r7 = 0 a=3; b=3; x=-a:0.1:a; y = -b:0.1:b; [x,y]=meshgrid(x,y); z = x + 1i*y; R = 1 + z + r2*z.^2 + r3*z.^3 + r4*z.^4 + r5*z.^5 + r6*z.^6; contour(x,y,abs(R),[0.001:0.005:1]);colorbar hold on; line([-a,a],[0,0]) line([0,0],[-b,b]) hold off grid on
7
Stability function for RK
clear % RK41 b=[1/6;1/3;1/3; 1/6]; c=[0;1/2; 1/2;1]; A=[ ;1/ ;0 1/2 0 0; ]; % % % RK42 % b=[1/6;0;2/3; 1/6]; % c=[0;1/4; 1/2;1]; % A=[ ;1/ ;0 1/2 0 0; ]; % % % % % RK5 % b=[7/90;0;32/90; 12/90;32/90;7/90]; % c=[0;1/4; 1/4;1/2;3/4;1]; % A=[ ;1/ ;1/8 1/ ;0 0 1/ ;3/16 -3/8 3/8 9/16 0 0;-3/7 8/7 6/7 -12/7 8/7 0]; % R(z) = 1 + z b^T ( I - z A )^(-1) 1 format rat r2 = b'*A^0*c, r3 = b'*A^1*c, r4 = b'*A^2*c r5 = b'*A^3*c, r6 = b'*A^4*c, r7 = b'*A^5*c r8 = b'*A^6*c % b'*A^7*c % b'*A^8*c % b'*A^10*c a=3; b=3; x=-a:0.1:a; y = -b:0.1:b; [x,y]=meshgrid(x,y); z = x + 1i*y; R = 1 + z + r2*z.^2 + r3*z.^3 + r4*z.^4 + r5*z.^5 + r6*z.^6; contour(x,y,abs(R),[1,1]);colorbar hold on; line([-a,a],[0,0]) line([0,0],[-b,b]) hold off grid on
8
Stability function for IRK
9
Stability function for IRK
one_v =ones(s,1) syms z NN = det(eye(s)+z*(one_v*b'-A)) DD = det(eye(s)-z*A) solve(DD) D = inline(DD) N = inline(NN) E = D(1i*y)*D(-1i*y) - N(1i*y)*N(-1i*y) a=40; b=20; x=-a:0.1:a; y = -b:0.1:b; [x,y]=meshgrid(x,y); z = x + 1i*y; R = subs(NN/DD); contour(x,y,abs(R),[0.1,0.4,0.7,1]); hold on; line([-a,a],[0,0]) line([0,0],[-b,b]) hold off grid on
10
Stability Padé approximant degree l degree m
Approximte f(z) by rational function
11
Stability
12
Stability Linear stability analysis is based on the linear test problem 1) non-autonomous generalizing this analysis in two possible ways 1) non-autonomous 2) Non-linear stability
13
Stability
14
Stability Example: is it A-stable is it AN-stable
15
Stability Definition: L-stable the method is A-stable and that, in addition,
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.