Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. [x,y]=meshgrid(-2.5:.01:2.5,-2.5:.01:2.5);
  2.  
  3. k=2.*x.^2-1.05.*x.^4+(x.^6)./6+x.*y+y.^2;
  4. f=@(x) 2.*x(1).^2-1.05.*x(1).^4+(x(1).^6)./6+x(1).*x(2)+x(2).^2;
  5.  
  6.  
  7. figure(1)
  8. contourf(x,y,k,80)
  9.  
  10. options = gaoptimset('PlotFcn',{@gaplotbestindiv,@gaplotbestf,@gaplotexpectation,@gaplotstopping},'TolFun',1e-4);
  11.  
  12. [x,fval,exitflag,output] = ga(f,2,options)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement