Parameter adjust for complex functions

4 visualizaciones (últimos 30 días)
Tomás Romero Pietrafesa
Tomás Romero Pietrafesa el 16 de Sept. de 2022
Respondida: Torsten el 16 de Sept. de 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

Respuesta aceptada

Torsten
Torsten el 16 de Sept. de 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)

Más respuestas (0)

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by