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

2 ビュー (過去 30 日間)
xueqi
xueqi 2014 年 7 月 9 日
回答済み: Shashank Prasanna 2014 年 7 月 9 日
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
Shashank Prasanna 2014 年 7 月 9 日
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 Center および File ExchangeSolver 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