pso example : f(x)= -x^2 + 2*x +11
Show older comments
in univeristy
2 Comments
James Tursa
on 9 Jun 2018
What is your question?
Image Analyst
on 9 Jun 2018
See this link and then ask a question and improve your post, like by attaching data, diagrams, or anything else to allow us to help you.
Answers (1)
Walter Roberson
on 9 Jun 2018
f = @(x) -x^2 + 2*x + 11;
nvars = 1;
lb = []; ub = [];
options = optimoptions('particleswarm', 'MaxIterations', 10000);
[x, fval] = particleswarm(f, nvars, lb, ub, options);
fprintf('pso stopped at x = %g at which time the function value was %g\n', x, fval);
Categories
Find more on Particle Swarm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!