I want to run Swarm optimization with a function written in the same script.
rng default % For reproducibility
nvars = 2;
x = particleswarm(fun,nvars)
function val = fun(x)
val=x(1)*exp(x(2));
end
When I run this script the promp windows shows me an error. How could I fix this?