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
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
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
Sergio Quesada 2018 年 6 月 4 日

0 投票

Exactly, i hace a collection of data (xi,yi) called (r,texp), and the fitting equation must be
texp(r)=FC*integral(@(x)exp(-a./x.*log(x)),1,texp)
thanks!

1 件のコメント

Walter Roberson
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
Sergio Quesada 2018 年 6 月 4 日
編集済み: Sergio Quesada 2018 年 6 月 4 日

0 投票

"texp" is my independent variable.
I have a collection of (r,texp) data. I have evaluated
FC*integral(@(x) -a./(x*log(x)),1,texp)
for each texp as upper integration limit with arbitrary values of "a" and "FC". Now i need to find the values of " a" and "FC" that best fits the experimental data

12 件のコメント

Walter Roberson
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
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
Sergio Quesada 2018 年 6 月 4 日
編集済み: Walter Roberson 2018 年 6 月 4 日
i'm sorry. I was wrong on my last answer, excuse me...
I have a data collection (r,texp). I also have values calculated according to
fun(i) = FC*integral(@(x) exp(-a./(x.*log(x))),1,texp(i))
And I need the best values of "a" and "FC" to fit fun(i) to texp as a function of r
Sorry again for the mistakes
Torsten
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
Walter Roberson 2018 年 6 月 4 日
Okay, but where does r come into this? Is r the same as fun?
Sergio Quesada
Sergio Quesada 2018 年 6 月 4 日
sorry again, walter... another mistake. I'm on several things at once and in addition i'm new on mathlab... The upper integration limits are actually the "r" values, not "texp":
fun(i) = FC*integral(@(x) exp(-a./(x.*log(x))),1,r(i))
Walter Roberson
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
Sergio Quesada 2018 年 6 月 4 日
編集済み: Sergio Quesada 2018 年 6 月 4 日
no, initially I call texp my initial experimental data, and fun(i) the values of the integral evaluated as:
fun(i)=FC*integral(@(x) exp(-a./(x.*log(x))),1,r(i))
Now I'm trying this:
liminf=ones(1,20);
fun=@(x,r)x(1)*integral(@(x,r)exp(-x(2)./(x.*log(x))),liminf,r);
x=lsqcurvefit(fun,x0,r,texp)
,which gives me:
Error using integral (line 85)
A and B must be floating-point scalars.
Error in @(x,r)x(1)*integral(@(x,r)exp(-x(2)./(x.*log(x))),liminf,r)
Error in lsqcurvefit (line 202)
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});
Caused by:
Failure in initial objective function evaluation. LSQCURVEFIT cannot
continue.
Walter Roberson
Walter Roberson 2018 年 6 月 4 日
What are class(r), class(texp), class(x0) ?
Sergio Quesada
Sergio Quesada 2018 年 6 月 4 日
'double' the three of them
Walter Roberson
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
Sergio Quesada 2018 年 6 月 4 日
success! i am so grateful Walter! This works thanks to people like you!
best regards

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDescriptive Statistics についてさらに検索

質問済み:

2018 年 6 月 4 日

コメント済み:

2018 年 6 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by