MATLAB: I am trying to solve a question related to Simulated Annealing, but I’m not able to form the objective function right. Can anybody help with this

MATLABobjective functions

I need to define the objective function first, so that I can use the Optimtool to solve the question for simulated Annealing.

Best Answer

syms i N1 N2 N3
F = symsum((N1-3)^2+(N2^i-3)^2+(N3^i-3)^2, i, 1, N1);
[N1g, N2g, N3g] = ndgrid(1:5);
R = subs(F,{N1, N2,N3},{N1g, N2g,N3g});
idx = find(R == min(R(:)));
[n1, n2, n3] = ind2sub(size(N1g), idx)
Related Question