diff --git a/README.md b/README.md index 1de772f..73ee1a7 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,15 @@ df = @(x) -(2*(x)^2-4*x+1)*exp(-(x-1)^2); | 4 | 3 | 4.9605 | | 5 | 3 | 4.3873 | ``` +```matlab +### convergence of Newton-Raphson method + +| iteration | x_i | approx error | +| --- | --- | --- | +| 0 | 1.2 | n/a | +| 1 | 1.2 | 22.1239 | +| 2 | 1.2 | 1.7402 | +| 3 | 1.2 | 0.0011 | +| 4 | 1.2 | 2.3315e-13 | +| 5 | 1.2 | 2.3315e-13 | +``` diff --git a/newtraph_f.m b/newtraph_f.m index fee1ee3..a2a83a7 100644 --- a/newtraph_f.m +++ b/newtraph_f.m @@ -1,3 +1,3 @@ f = @(x) (x-1)*exp(-(x-1)^2); df = @(x) -(2*(x)^2-4*x+1)*exp(-(x-1)^2); -[root,ea,iter]=newtraph(f,df,3,.00001,5) \ No newline at end of file +[root,ea,iter]=newtraph(f,df,1.2,.00001,5) \ No newline at end of file