fminsearch with an integral function

9 visualizaciones (últimos 30 días)
Pedro Araújo
Pedro Araújo el 14 de Abr. de 2020
Comentada: Ameer Hamza el 15 de Abr. de 2020
Hello!
I want to minimize a function with an integral using fminsearch. The question is that I dont know how to define it properly.
The function i want to minimize is:
I want to minimize it respective to θ being A, given by the user before any calculation.
How can i define the function and the fminsearch procedure?
Thanks!

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 15 de Abr. de 2020
See this code
A = 1;
sigma0 = 2;
int_term = @(theta) integral(@(phi) 1/(sigma0*sqrt(2*pi))*exp(-1/2*(phi/sigma0).^2).*sin(theta-phi), 0, 2*pi);
obj_fun = @(theta) -A*cos(theta)+int_term(theta);
theta_sol = fsolve(obj_fun, 0)
  8 comentarios
Pedro Araújo
Pedro Araújo el 15 de Abr. de 2020
Thanks a lot!
I will progress much faster!!!
Ameer Hamza
Ameer Hamza el 15 de Abr. de 2020
Glad to be of help.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by