Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [ x0 ] = sieczna( f, x1, x2 )
- f1 = f(x1);
- f2 = f(x2);
- E = 0.0001;
- for i=64:-1:0
- if abs(x1-x2) > E
- if abs(f1-f2) < E
- disp('Zle punkty startowe');
- break;
- else
- x0 = x1-f1*(x1-x2)/(f1-f2);
- f0 = f(x0);
- if abs(f0) < E
- break;
- else
- x2 = x1;
- f2 = f1;
- x1 = x0;
- f1 = f0;
- end
- end
- else
- break;
- end
- end
- if i <= 0;
- disp('Przekroczono limit obiegow');
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment