Advertisement
kaburen

met_siecznych now

Apr 9th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.27 KB | None | 0 0
  1. function [wyn] = met_siecznychv2(g,x1,x2)
  2. f = @(x)eval(g);
  3. ep = 0.001;
  4. if(f(x1)*f(x2)>0)
  5.    disp('Punkty  nie spelniaja zalozen')    
  6.    return;
  7. end
  8. while(abs(f(x2))>ep)
  9.     x0 = x1 - f(x1)*(x1-x2)/(f(x1)-f(x2));
  10.     x2 = x1;
  11.     x1 = x0;      
  12. end
  13. wyn = x0;
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement