Fitting data to integral function
显示 更早的评论
Hi everybody. I'm trying to fit an essemble of data ("r" as x and "texp" as y) by a function defined by an integral:
FC*integral(@(x)exp(-a./x.*log(x)),1,texp)
, were both "FC" and "a" are the parameters to fit, while "texp" are the upper integration limits, which must be equal to the "y" parameters at each point.
Thank you so much !
2 个评论
Torsten
2018-6-4
So you have data (xi,yi) that should be representable by
(texp(i),FC*integral(@(x)exp(-a./x.*log(x)),1,texp(i)))
?
Walter Roberson
2018-6-4
What should the expression equal?? Is it
texp = FC*integral(@(x)exp(-a./x.*log(x)),1,texp)
?
Where is your independent variable?
回答(2 个)
Sergio Quesada
2018-6-4
0 个投票
1 个评论
Walter Roberson
2018-6-4
Where is your independent variable appearing in the model? Is texp(r) intended to convey "the texp that corresponds to r", or is texp somehow intended to be both a function to be applied to r on the left side, but a particular numeric value on the right hand side where it is acting as the upper bounds of the integral ?
Or is texp(r) intended to be multiplication, as in
texp(K) * r(K) == FC * integral(@(x)exp(-a./x.*log(x), 1, texp(K))
and thus
texp(K) == FC / r(K) * integral(@(x)exp(-a./x.*log(x), 1, texp(K))
Sergio Quesada
2018-6-4
编辑:Sergio Quesada
2018-6-4
0 个投票
12 个评论
Walter Roberson
2018-6-4
If texp is your independent variable, then where does your dependent variable r appear? Is it
r = FC*integral(@(x) -a./(x*log(x)),1,texp)
Torsten
2018-6-4
So you have experimental data (r(i),texp(i)) and function values calculated according to
fun(i) = FC*integral(@(x) exp(-a./(x*log(x))),1,texp(i))
What are the data from your experiment that fun(i) should equal after optimizing a and FC ?
And please don't always open new "Answers" when you should add a Comment.
Sergio Quesada
2018-6-4
编辑:Walter Roberson
2018-6-4
Torsten
2018-6-4
I still don't understand, but I'm sure "lsqcurvefit" or "lsqnonlin" can solve your problem.
Best wishes
Torsten.
Walter Roberson
2018-6-4
Okay, but where does r come into this? Is r the same as fun?
Sergio Quesada
2018-6-4
Walter Roberson
2018-6-4
Is fun(i) the same as texp(i) ?
texp(i) = FC*integral(@(x) exp(-a./(x.*log(x))),1,r(i))
Sergio Quesada
2018-6-4
编辑:Sergio Quesada
2018-6-4
Walter Roberson
2018-6-4
What are class(r), class(texp), class(x0) ?
Sergio Quesada
2018-6-4
Walter Roberson
2018-6-4
fun = @(FCa, r) arrayfun(@(R) FCa(1) * integral(@(x) exp(-FCa(2)./(x.*log(x))), 1, R), r);
FCa = lsqcurvefit(fun, x0, r, texp);
FC = FCa(1); a = FCa(2);
Sergio Quesada
2018-6-4
类别
在 帮助中心 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!