MATLAB: Does simulation annealing minimize objective function which has non constant parameter

MATLABminimumoptimization

Main File
============================
a0 = [.0001 .0001 .0001 .0001 .0001 ];
w = linspace(0,pi,1000);
for i=1:length(w)
w_scal=w(i);
f =@(a)abc(a,w_scal);
[a_vec fval] = simulannealbnd(f,a0);
end
Function File
============================
function ARE = abc(a,w)
ERR = ((1/(j*w)) – ((a(1)*exp(2*j*w) + a(2)*exp(j*w) + a(3)) / (exp(2*j*w)+a(4)*exp(j*w) + a(5)))/(1/(j*w)));
ARE = sum(ERR.^2);
After estimating variables a(1),a(2)..a(5), the ARE's Plot w.r.t w(Omegha)is.
===========================================================================
But The plot should draw like these two graphs.
===============================================
Conclusively, coefficients a(1)….a(5) are not estimated correctly.
Thanks,
Nitin

Best Answer

I still don't see where you set the variable "j" in your function "abc".
Best wishes
Torsten.