I have the function
where I know the , and σ
How can I find the two params x and y that minimize the function which variable is ξ ?

댓글 수: 1

Torsten
Torsten 2020년 4월 12일
x = Inf, y finite, but arbitrary minimizes the function.

댓글을 달려면 로그인하십시오.

 채택된 답변

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 4월 12일
편집: Thiago Henrique Gomes Lobato 2020년 4월 12일

0 개 추천

You can define it as an annonymous function and then call fminsearch to solve it:
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

Nico
Nico 2020년 4월 12일
yeah, it may need an abs() but, why have you added the e = 5 ?
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.
Nico
Nico 2020년 4월 13일
gotcha, everything is working
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Language Fundamentals에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 4월 12일

댓글:

2020년 4월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by