## Is the system trapped in a local mínimum?

Clear
>> alfa=10^-1.1; beta=10^-.9; pot=.5;
for c=1:100
pos_opt(1:279,c)=coste2pos_num_ruido(todas.A*alfa,todas.M*beta+todas.S,todas.f,pot,0,1,1);
hold on
end

Now, run the optimization with the real position as starting point (red line)

I modify coste2pos_num_ruido,

pos=rand(n_neuronas,1);

% **

pos=todas.pos_real;

% **

c_iteraciones=1;

>> pos_opt_cercareal=coste2pos_num_ruido(todas.A*alfa,todas.M*beta+todas.S,todas.f,pot,0,1,1);

for c=1:100
costes(c)=pos2coste(todas.A*alfa,todas.M*beta+todas.S,todas.f,pos_opt(:,c),pot);
end
>> [m,ind_min]=min(costes);
>> pos_opt_min=pos_opt(:,ind_min);
>> mean(abs(pos_opt_min-pos_opt_cercareal))
ans =
0.0842
>> vector=todas.pos_real-pos_opt_min;
>> coef=-.5:.05:1.5;
>> for c=1:length(coef)
coste_vec(c)=pos2coste(todas.A*alfa,todas.M*beta+todas.S,todas.f,pos_opt_min+vector*coef(c),pot);
end
>> figure
>> plot(coef,coste_vec)

There is a smooth way to the optimum, although my optimizer is unable to find it. So it does not look like a local minimum in the general multidimensional surface (although in some directions there are local minima, klar)