Parameter adjust for complex functions

3 ビュー (過去 30 日間)
Tomás Romero Pietrafesa
Tomás Romero Pietrafesa 2022 年 9 月 16 日
回答済み: Torsten 2022 年 9 月 16 日
Dear all,
I've got a function with four parameters that i want to adjust in order to get the minimum possible error. Like the following:
function[error]=FUN(f1,f2,f3,f4) %Being f1, f2, f3 & f4 the parameters and [error] the number to minimize
end
This function is quite complex and I can't use it with fminsearch (i can't write it as function handle), so I wanted to ask if there is any other function that can run it several times, modifying f1,f2,f3 & f4 in order to find a local minimun. I couldn't find anything in the MATLAB help that would do this.
Sorry if I got any grammar/spelling errors, my english is a bit rusty :)
Best regards,
Tomás

採用された回答

Torsten
Torsten 2022 年 9 月 16 日
fminsearch also works with functions, not only function handles.
fun = @(f)FUN(f(1),f(2),f(3),f(4));
f10 = ...;
f20 = ...;
f30 = ...;
f40 = ...;
f0 = [f10,f20,f30,f40];
f = fminsearch(fun,f0);
f1 = f(1)
f2 = f(2)
f3 = f(3)
f4 = f(4)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by