MATLAB Answers

fit with integral function involved

1 view (last 30 days)
Daniele Sonaglioni
Daniele Sonaglioni on 3 Mar 2021
Hello everybody,
i have a problem with mi code. I need to fit this function to my experimental data:
where
and
in which E_1,E_2,T^* and T^' are my fitting parameters and T is my abscissa.
I have a subroutine previously written but i have some problem in insterting the T variable in my script.
Below I show the subroutine i have previosly written (the shape of the function is a bit different):
function y = integralfit(b,Tv,R,nu,T0)
% % % MAPPING: b(1) = E1, b(2) = E2, b(3) = Tstar, b(4) = Tdot
for k = 1:numel(Tv)
k3 = @(T) exp(-b(2).*(1./T - 1./b(3))./R);
K = @(T) exp(-b(1).*(1./T - 1./b(4))./R);
y(k) = (b(1)/nu) .* k3(Tv(k)).* K(Tv(k)) .* exp(-(1./nu).*integral(@(T) k3(T).*K(T), T0, Tv(k), 'ArrayValued',1));
end
end
Here i show my attemp to modify the subroutine:
function y = integralfit(b,Tv,R,nu,T0)
for k = 1:numel(Tv)
k3 = @(T) exp(-b(1).*(1./T - 1./b(2))./R);
K = @(T) exp(-b(3).*(1./T - 1./b(4))./R);
y(k) =@(T) ((b(1)*K(Tv(k)))./(K(Tv(k))+1).^2).*(K(Tv(k))./nu+b(1)./(R*T.^2)).* exp(-(1./nu).*integral( (k3.*K)./(1+K), T0, Tv(k), 'ArrayValued',1));
end
end
Do you have any suggestion?
It seems that the the problem is in the definition of y(k).

Answers (0)

Community Treasure Hunt

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

Start Hunting!