Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Integration.

Similar presentations


Presentation on theme: "Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Integration."— Presentation transcript:

1

2 Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Integration

3 Numerical Operations: U of M-Dearborn ECE Department Introduction to MATLAB and its Toolboxes Integration 2 Integration Topics n Numerical Integration Numerical Integration n General M-Functions General M-Functions n Integral M-Function Integral M-Function n Integration M-Function Example Integration M-Function Example

4 Numerical Operations: U of M-Dearborn ECE Department Introduction to MATLAB and its Toolboxes Integration 3 Numerical Integration n For an arbitrary 2-D curve, the area under the curve is defined as:

5 Numerical Operations: U of M-Dearborn ECE Department Introduction to MATLAB and its Toolboxes Integration 4 Matlab M-Functions n Matlab allows users to create M-Functions which can be called by Matlab. n The commands and functions that comprise the new function must be put in a file whose name defines the name of the new function n Use filename extension of '.m' n At the top of the file must be a line that contains the syntax definition for the new function

6 Numerical Operations: U of M-Dearborn ECE Department Introduction to MATLAB and its Toolboxes Integration 5 n The file will contain only the following lines: function y=fint(x) y = exp(x) + atan(x); Integral M-Function n Find the following integral numerically n In Matlab, create a new m-file named fint.m to define the function fint Output Vector Input Vector File Named fint.m

7 Numerical Operations: U of M-Dearborn ECE Department Introduction to MATLAB and its Toolboxes Integration 6 Calculating the Integral quad is used to calculate the area (integral) » area=quad('fint',0,1) Upper Limit area = Lower Limit Function Name (string) 2.1571 To get a more exact answer use quad8 In the function fint, we assume that x is a vector


Download ppt "Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Integration."

Similar presentations


Ads by Google