Parameter adjust for complex functions
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Tomás Romero Pietrafesa
le 16 Sep 2022
Réponse apportée : Torsten
le 16 Sep 2022
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
0 commentaires
Réponse acceptée
Torsten
le 16 Sep 2022
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!