Matlab中报错
fun=zeros(popsize,dimension);
for i=1:popsize
for j = 1:dimension-1
fun(i) = fun(i) + (1-x(i,j))^2 + 100*(x(i,j+1) - x(i,j)^2)^2 ;
fun=@(x)[10*(x(2) - x(1)^2),1 - x(1)];
x0 =[1.3,0.7,0.8,1.9,1.2];
[x,fval] = fminunc(fun,x0)
for i=1:popsize
for j = 1:dimension-1
fun(i) = fun(i) + (1-x(i,j))^2 + 100*(x(i,j+1) - x(i,j)^2)^2 ;
fun=@(x)[10*(x(2) - x(1)^2),1 - x(1)];
x0 =[1.3,0.7,0.8,1.9,1.2];
[x,fval] = fminunc(fun,x0)