Advertisement
encoree1996

Untitled

Jun 15th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. funk = '3*x^2-6*x+1';
  2. f = inline(funk);
  3. a = -10;
  4. b = 10;
  5. minv = f(a);
  6. minx = a;
  7. fb = f(b);
  8. if fb < minv
  9. minv = fb;
  10. minx = b;
  11. end
  12. d = diff(sym(funk));
  13. mzerowe = solve(d);
  14. for i=1:length(mzerowe)
  15. if f(mzerowe) < minv
  16. minv = f(mzerowe);
  17. minx = mzerowe;
  18. end
  19. end
  20.  
  21. minv
  22. minx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement