Presentation is loading. Please wait.

Presentation is loading. Please wait.

數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.

Similar presentations


Presentation on theme: "數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration."— Presentation transcript:

1 數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration

2 數值方法 2008, Applied Mathematics NDHU 2 Four 2-variate Gaussians

3 數值方法 2008, Applied Mathematics NDHU 3 Four 2-variate Gaussians

4 數值方法 2008, Applied Mathematics NDHU 4 Gaussian pdf

5 數值方法 2008, Applied Mathematics NDHU 5 Weight sum of Gaussian pdfs

6 數值方法 2008, Applied Mathematics NDHU 6 myfx4.m

7 數值方法 2008, Applied Mathematics NDHU 7 Plot 4G plot_4G.m

8 數值方法 2008, Applied Mathematics NDHU 8 Integration of 4G demo_int_4G.m Double integration

9 數值方法 2008, Applied Mathematics NDHU 9 exp(cos(x)) plot_expcos.m

10 數值方法 2008, Applied Mathematics NDHU 10 Definite Integration demo_quad.m

11 數值方法 2008, Applied Mathematics NDHU 11 Symbolic integration demo_int.m

12 數值方法 2008, Applied Mathematics NDHU 12 Example function of x:x.^2+2*x-5 fx1 = Inline function: fx1(x) = 1./3.*x.^3+x.^2-5.*x

13 數值方法 2008, Applied Mathematics NDHU 13 Numerical integration - quadrature

14 數值方法 2008, Applied Mathematics NDHU 14 Counter example >> demo_int function of x:(1-sin(x.^2)).^(1/3) Warning: Explicit integral could not be found.

15 數值方法 2008, Applied Mathematics NDHU 15

16 數值方法 2008, Applied Mathematics NDHU 16 plot_sin13.m

17 數值方法 2008, Applied Mathematics NDHU 17 Numerical integration demo_quad2.m

18 數值方法 2008, Applied Mathematics NDHU 18 Mesh

19 數值方法 2008, Applied Mathematics NDHU 19 Lower and upper sum

20 數值方法 2008, Applied Mathematics NDHU 20 Lower sum : lower bound

21 數值方法 2008, Applied Mathematics NDHU 21 Upper sum : upper bound

22 數值方法 2008, Applied Mathematics NDHU 22 Composite Trapezoid rule

23 數值方法 2008, Applied Mathematics NDHU 23 Uniform mesh

24 數值方法 2008, Applied Mathematics NDHU 24 Associate error

25 數值方法 2008, Applied Mathematics NDHU 25 Partition size

26 數值方法 2008, Applied Mathematics NDHU 26 Procedure: Composite Trapezoid rule 1. Get ss, a and b 2. Set fx to inline(ss); Set n 3. h = (b-a)/n; result = 1/2*(fx(a)+fx(b)); for i=1:n Add fx(a+i*h) to result Add fx(a+i*h) to result 4. Return result*h

27 數值方法 2008, Applied Mathematics NDHU 27 Simpson rule for numerical integration

28 數值方法 2008, Applied Mathematics NDHU 28 Exercise Due to 12/19 ► Implement the composite Trapezoid rule for numerical integration, including flow chart and Matlab codes ► Implement the composite Sympson rule for numerical integration, including flow chart and Matlab codes ► Test your matlab function with the following integration ► * Test your matlab function with definite integration of the weight sum of four Gaussian pdfs ► * Compare your results with those obtained by using quad.m f(x)=exp(cos(x))


Download ppt "數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration."

Similar presentations


Ads by Google