Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [wyn] = met_styczv2(g,x0)
- %('x^2+x-1',-1) % Miejsce zerowe: -1.6180 oraz 0.6180
- syms x;
- ep = 0.001;
- f = @(x)eval(g);
- z = diff(eval(g));
- fp = @(x)eval(z);
- for i = 1:10
- x1 = x0 - f(x0)/fp(x0);
- if(abs(f(x0)-f(x1))<ep)
- break
- end
- x0 = x1;
- end
- wyn = x0;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement