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

2 次查看(过去 30 天)
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

回答(1 个)

Shashank Prasanna
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:

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by