Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [] = secante(funcao, a, b, erro, max)
- % paulogp
- % metodo da secante
- disp(' ');
- % passar para funcao
- f = inline(funcao);
- min = 0;
- d = 100;
- while ((min<max) && (d>erro))
- c = f(a)/f(b);
- d = ((a-b)*c)/(1-c);
- g = b-d;
- min = min+1;
- a = b;
- b = g;
- f(a) = f(b);
- f(b) = f(g);
- disp(' ');
- disp(['g = ' mat2str(g)]);
- disp(' ');
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement