tailieunhanh - APPLIED NUMERICAL METHODS USING MATLAB phần 6

khối báo cáo năm (c) vào các thói quen "smpsns ()" và "adap_smpsn ()" để làm cho họ đối phó với các trường hợp của NaN (không một số) và Inf (Infinity) . (iii) Bổ sung các chương trình "" để các thói quen khác nhau được áp dụng để tính tích phân () | 250 NUMERICAL DIFFERENTIATION INTEGRATION ii Add the block of statements in c into the routines smp-sns and adap_smpsn to make them cope with the cases of NaN Not-a-Number and Inf Infinity . iii Supplement the program so that the various routines are applied for computing the integrals and where the parameters like the number of segments N 200 the error tolerance tol 1e-4 and the number of grid points MGL 20 are supposed to be used as they are in the program. Noting that the second integrand function in oscillates like crazy with higher frequency and larger amplitude as y gets closer to zero 0 set the lower bound of the integration interval to a2 . iv Run the supplemented program and fill in Table with the absolute errors of the results. nm5p06a warning off MATLAB divideByZero fp56a inline sin x . x x fp56a2 inline sin 1. y . y y IT pi 2 True value of the integral a 0 b 100 N 200 tol 1e-4 MGL 20 a1 0 b1 1 a2 b2 1 format short e e_s smpsns fp56a a b N -IT e_as adapt_smpsn fp56a a b tol -IT e_ql quadl fp56a a b tol -IT e_GL Gauss_Legendre fp56a a b MGL -IT e_ss smpsns fp56a a1 b1 N smpsns fp56a2 a2 b2 N -IT e_Iasas adapt_smpsn fp56a a1 b1 tol . -IT e_Iqq quad fp56a a1 b1 tol -IT warning on MATLAB divideByZero nm5p06b warning off MATLAB divideByZero fp56b inline exp -x. x x fp56b1 inline ones size x x fp56b2 inline exp -1. y. y . y. y y a 0 b 200 N 200 tol 1e-4 It sqrt pi 2 a1 0 b1 1 a2 0 b2 1 MGH 2 e_s smpsns fp56b a b N -IT e_as adapt_smpsn fp56b a b tol -IT e_q quad fp56b a b tol -IT e_GH Gauss_Hermite fp56b1 MGH 2-IT e_ss smpsns fp56b a1 b1 N smpsns fp56b2 a2 b2 N -IT Iasas adapt_smpsn fp56b a1 b1 tol . -IT e_qq qUad fp56b a1 b1 tol -IT warning off MATLAB divideByZero PROBLEMS 251 Table Results of Applying Various Numerical Integration Methods for Improper Integrals Simpson adaptive quad Gauss S S a a q q 0 0 b To apply the .

TỪ KHÓA LIÊN QUAN