Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE:211 Computational Techniques in Electrical Engineering Lecture#2

Similar presentations


Presentation on theme: "EE:211 Computational Techniques in Electrical Engineering Lecture#2"— Presentation transcript:

1 EE:211 Computational Techniques in Electrical Engineering Lecture#2
Dr. Mubashir Alam King Saud University

2 Outline Chapter#3 Rootfinding Bisection Method Newton's Algorithm
Secant Method

3 Introduction

4 The Bisection Method

5

6 Example: 3.1.1

7

8 Error Bounds α is the true root and cn is its estimate Error: |α-cn|

9

10 Newton’s Algorithm

11

12

13

14 If x1 is the root of p(x) then p(x1)=0
Repeat the next with x1 as the initial estimate and determine x2 And so on

15 Newton’s Method

16 Example: 3.2.1

17 Stopping criteria

18 Example n xn f(xn) xn-xn-1 1.5 8.890625 ------------------ 1
1.5 1 2 3 4 x 10-3 x 10-3 Stopping criteria, ε = 1 x 10-2

19 Example: 3.2.1

20

21 Example: 3.2.2

22

23

24 Secant Method From this perspective, other straight-line approximation to y=f(x) would also lead to methods for approximating a root of f(x). One such straight-line approximation leads to SECANT METHOD

25 The two pints (x0,f(x0)) and (x1,f(x1)) , on the graph of y=f(x), determine
a straight line , called a secant line. This line is an approximation to the graph of y=f(x), and its root x2 is an approximation to true root α.

26 Equation of lines Equation of line with slope = m and passing through a point (x1,y1): y-y1 = m(x-x1) y = y1+ m(x-x1) Slope of the line between points (x1,y1) and (x2,y2) Slope = m = (y2- y1) / (x2- x1)

27 Secant Method Find the equation of the line and then its root x2
Having found x2, we can drop x0, and use x1,x2 as a new set of approximate values for α. This will lead to an improved value x3. Continue this process …..

28 Secant Method General Formula:
Two point method, since two approximate values are needed to obtain the next improved value.

29 Example: 3.3.1

30

31

32

33

34

35 Matlab Function: fzero
This function uses ideas involved in the bisection and the secant method. Use: root=fzero(f_name, [a,b]) Produces a root within [a,b], assume f(a)f(b) <= 0 Use: root=fzero(f_name, xo) Find a root near x0.

36 Matlab Function: fzero
Define function for: f(x)=x6-x-1 function f = myfun(x) f = x.^6-x-1; x=


Download ppt "EE:211 Computational Techniques in Electrical Engineering Lecture#2"

Similar presentations


Ads by Google