Find params that minimize function
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nicola Caldognetto
el 12 de Abr. de 2020
Comentada: Nicola Caldognetto
el 13 de Abr. de 2020
I have the function
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/283857/image.png)
where I know the
,
and σ
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/283858/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/283859/image.png)
How can I find the two params x and y that minimize the function which variable is ξ ?
1 comentario
Respuesta aceptada
Thiago Henrique Gomes Lobato
el 12 de Abr. de 2020
Editada: Thiago Henrique Gomes Lobato
el 12 de Abr. de 2020
e = 5;
xi = [1,2,3,4];
yi = [3,4,5,6];
sigma = 2
fun = @(x,e,xi,yi,sigma) abs(4*e- sum(sqrt( (x(1)-xi).^2-(x(2)-yi).^2 ))/(2*sigma^2));
x0 = [1,1];
[x,fval] = fminsearch(@(x)fun(x,e,xi,yi,sigma),x0)
I changed your function with an abs() function, which I believe it was your intention, otherwise your function has no minimum since it can go to -inf.
3 comentarios
Thiago Henrique Gomes Lobato
el 12 de Abr. de 2020
I just added random values to all variables to get a result. From your question I understood that you want to find the x and y that minimizes your function for a given e. If you want also to minimize e you can add it to the optimization function as a parameter, although the resulting function will have infinite local minima.
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!