How to find the Root of dichotomy equation by matlab
This article mainly introduces matlab how to achieve the root of the dichotomy equation, the article is very detailed, has a certain reference value, interested friends must read it!
Hypothesis function
In the interval
It is continuous, and it can be solved by dichotomy at this time.
Solve the pseudo code:
A1 = a
B1 = b
Calculation midpoint
If, then the solution of the equation is terminated.
If
If
If
Repeat steps 2 through 4 above until the error is met and the iteration is stopped.
Convergent property
Is the result of the nth iteration, p is the real solution.
Give an example
The approximate solution of the equation on the interval [0BAE 2].
So the interval is scaled to [1pc2]
Using matlab, the calculation is as follows:
%-inputs-f = @ (x) 3x ^ x ^ 2-x Murray 3politics a = 0scape b = 2politics% tolerance / max iterTOL = 1eMurray 4; NI = 50 %--% STEP 1: initializationi = 1 fa = f (a); converge = false;% convergence flag% STEP 2: iterationwhile I