data fitting by Integration with variable limit with a unknown parameter.

3 views (last 30 days)
I want to fit experimental data with equation:
y = C(1) * 74.826 * (x/T(1))^3 * integration (t^4*exp(t)/(exp(t)-1)^2), 0, T(1)/x) + C(2) * 24.942 * (T(2)/x)^2 * exp(T(2)/x)/(exp(T(2)/x)-1)^2 + C(3) * 24.942 * (T(3)/x)^2 * *exp(T(3)/x)/(exp(T(3)/x)-1)^2
with six unknown parameters: C(1), T(1), C(2), T(2), C(3), T(3).
The integral part is giving error all times. How to write the programm please help.
Thank you.

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 11 Jan 2021
You can do something like this:
y_fcn = @(CT,x) CT(1) * 74.826 * (x./CT(4)).^3 * integral(t.^4.*exp(t)./(exp(t)-1).^2), 0, CT(4)./x) + ...
CT(2) * 24.942 * (CT(5)./x).^2 .* exp(CT(5)./x)./(exp(CT(5)./x)-1).^2 + CT(3)*24.942*(CT(6)./x).^2.*exp(CT(6)./x)./(exp(CT(6)./x)-1).^2;
err_fcn = @(CT,x,y) sum((y-y_fcn(CT,x)).^2);
CT0 = [1 2 3 4 5 7]; % Some sensible initial guess for C and T, that we concatenate together as CT = [C,T]
CT_best = fminsearch(@(CT) err_fcn(CT,x_obs,y_obs),CT0)
You most likely have to use element-wise operations in the equation for y (I might have missed one or two multiplictions or power-operations). Then it should be fine to use ordinary least-square fitting of the C and T parameters (provided you have enough data-points, and they have the same standard deviation - but I expect you to know this already).
HTH
  5 Comments
Shobha Gondh
Shobha Gondh on 13 Jan 2021
The equation is:
P = P0 + 4RC*(T/C)^5* integration (0, (C/T)) (x^5/(exp(x)-1)*(1-exp(-x))) dx
P0, R and C are constants.
With given values of P and T, finding these constants.
program in matlab for this :
Tv = linspace(200, 300, 10).'; % vector of T values
Pv = Tv.^2; % vector of P values
P_mdl = @(P0, R, C, TT) arrayfun(@(T) P0 + 4*R.*C.*(T/C).^5 * integral(@(x) x.^5./(exp(x)-1).*(1-exp(-x)), 0, (C/T)), TT);
sol = lsqcurvefit(@(param, T) P_mdl(param(1), param(2), param(3), T), rand(3,1), Tv, Pv);
P0_sol = sol(1);
R_sol = sol(2);
C_sol = sol(3);
This is same variable uper limit integration case but what are these Tv and Pv ? please help me to write program in this lsqcurvefit.
That cumintegral is also not giving the results. cumintegral is coming as undefined variable.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!