Minimization problem with integral constraint

조회 수: 3 (최근 30일)
Esteban Garcia
Esteban Garcia 2022년 5월 9일
댓글: Esteban Garcia 2022년 5월 11일
Hello, I'm working with a 2D numerical density profile. . I have a set of radius a maximum radius R and I want to find the best fit to the data r. I know that I can use maximum likelihood or another method, but I have problems with the constraints for , because I require that
At first I tried with bins and adjusted the curve with cftool, but I need more precision. So I want to use minimization with that constraint.
Thank you so much.

채택된 답변

Matt J
Matt J 2022년 5월 9일
편집: Matt J 2022년 5월 9일
Perhaps you could reparametrize the curve as,
which automatically satisfies the constraint for any b and c. Moreoever, since this form has only two unknown parameters, it should be relatively easy to do a parameter sweep to find at least a good initial guess of b and c.
  댓글 수: 7
Matt J
Matt J 2022년 5월 10일
Maybe fitting log(sigma) will behave better.
Esteban Garcia
Esteban Garcia 2022년 5월 11일
Hello Matt it is much faster now without symbolyc and with log. Thank you
N=length(Rproj);
R=max(Rproj);
A=1000000
B=0
C=0
syms b c
for j=1:N
F(j)=log(2*Rproj(j)*(1+(Rproj(j)/b)^2)^c/(((b^2+R^2)^(c+1)-b^(2*c+2))/(b^(2*c)*(c+1))));
end
E=-sum(F);
fstr=string(E);
fstr=replace(fstr,'b','b(k)');
fstr=replace(fstr,'c','c(j)');
b=0.01:0.001:0.8
c=-1.405:0.001:-0.705
for k=1:length(b)
for j=1:length(c)
n=eval(fstr);
if n<A
A=n;
B=b(k);
C=c(j);
end
end
end

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

추가 답변 (1개)

Mitch Lautigar
Mitch Lautigar 2022년 5월 9일
My suggestion is to use a smaller step size for <a,b,c> if you know what they are. Typically when you are trying to fix the curve, the only thing you can do is try to add in more datapoints. If you can provide some code, I can provide more feedback.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by