SHARE
TWEET

Untitled

a guest Jun 16th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Zestaw 4
  2.  
  3. %ad.3a)
  4. ezplot('10*x-exp(-x)'),[-2,4] // rysuje funkcje w przedziale <-2;4>
  5.  
  6. //ad.b)
  7. f=inline('10*x-exp(-x)')
  8.  
  9. a=-1
  10. b=1
  11. n=input('n = ');
  12.  
  13. for k=0:n
  14. if f(a)*f(b) < 0
  15.     bp=b;
  16.     b=(a+b)/2;
  17.     c=b;
  18. elseif f(a)*f(b) > 0
  19.     a=(a+bp)/2;
  20.         c=a;
  21. end
  22. end
  23. disp('Wynik = ')
  24. disp(c)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top