how to write the code to smooth a function and then minimize it

1 view (last 30 days)
xueqi
xueqi on 9 Jul 2014
Dear fellows,
I am a little confused with how to use the function smooth in matlab. At the moment I have a function f(x), here x contains 6 independent variable. I would like to first smooth this function then minimize it. So I write the code as follows.
if true
% [X,F,exitflag] = ga(@(x)smooth(f(x,spf,DD,C),'rlowess'),6,[],[],Aeq,1,lb,ub,[],[]);
end
But ga still fails to find the correct minimum (which I know where it is as I am doing a simulation) and returns exact the same answer as in the case of just minimizing f. I am not sure where is this problem. Could you shed some light on this?
Thanks, Xueqi

Answers (1)

Shashank Prasanna
Shashank Prasanna on 9 Jul 2014
GA is quite robust to discontinuities and 'non-smooth' objective functions. Did you give it a try without smoothing?
When the solver finishes, it exists under certain conditions. You may be able to relax/tighten tolerances for better results. I highly recommend these steps in the documentation:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!