data fitting by Integration with variable limit with a unknown parameter.
3 views (last 30 days)
Show older comments
Shobha Gondh
on 11 Jan 2021
Commented: Bjorn Gustavsson
on 16 Jan 2021
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.
0 Comments
Accepted Answer
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
Bjorn Gustavsson
on 16 Jan 2021
Ah, I forgot to attach the cumintegral function. Here it is...
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!