Parameter adjust for complex functions

4 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Get 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