using Schroders iteration. How to start? I am new to matlab

2 visualizaciones (últimos 30 días)
Cleven Hartono
Cleven Hartono el 20 de Feb. de 2016
Respondida: Arnab Sen el 24 de Feb. de 2016
Part 2 Implement a MATLAB function schroderbisection.m of the form
function [r, h] = schroderbisection(a, b, f, fp, fpp, t)
% a: Beginning of interval [a, b]
% b: End of interval [a, b]
% f: function handle f(x) to find a zero for
% fp: function handle f’(x)
% fpp: function handle f’’(x)
% t: User-provided tolerance for interval width
which combines the fast convergence of the Schro ̈der iteration for multiple roots
g(x)=((x - f(x)/f'(x) * 1 / ( 1 - (f(x) - f'(x))/f'(x)^2))
= x - (f(x) f'(x)/ f'(x)^2 - f(x)f''(x))
with the bracketing guarantee of bisection. At each step j = 1 to n, carefully choose p as in geometric mean bisection (watch out for zeroes!). Define
ε = min(|f (b) f (a)|/8, |f ′′ (p)||b a|2 )
Apply the Schro ̈der iteration function g(x) to two equations f±(x) = f(x) ± ε = 0, yielding two candidates x = q± = g±(p). Replace [a,b] by the smallest interval with endpoints 1 chosen from a, p, q+, q− and b which keeps the root bracketed. Repeat until a f value exactly vanishes, b − a ≤ t, or b and a are adjacent floating point numbers, whichever comes first. Return the final approximation to the root r = (a + b)/2 and a 6 × n history matrix h[1:6,1:n] with column h[1:6,j] = (a,p,q−,q+,b,f(p)) recorded at step j.

Respuestas (1)

Arnab Sen
Arnab Sen el 24 de Feb. de 2016
Hi Cleven ,
I think you are looking for a way to represent the function 'f' and take it's differential. You can use the anonymous function for this purpose like below:
>> f = @(p)600*p^4-550*p^3+200*p^2-20*p-1;
Now, the function is created and the handle is help by the variable 'f'. For example, f(3) will evaluate the function at x=3 and output 35489.
For more detail about the 'Anonymous Function', refer to the following link:
For differentiation, you may refer to the following link:
You can refer to this link for an illustration on how to implement bisection and secant method which you can easily extend to your required algorithm.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by