Minimization problem with integral constraint

4 次查看(过去 30 天)
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 个评论
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