Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cf = input('Ingrese funcion f: ');
- cg = input('Ingrese funcion g: ');
- f = inline(cf);
- g = inline(cg);
- syms x
- dg = diff(cg,x);
- x = input('Ingrese primer valor: ');
- if(abs(eval(dg))<1)
- tol = input('Ingrese tolerancia: ');
- disp(' n x0 error')
- fprintf(' 0.0000 %7.4f ------\n',x)
- n = 0; error = 100;
- while(error>tol)
- n = n+1;
- x = g(x);
- error = abs(f(x));
- disp([n,x,error])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement