How to fit an integral with data points in Matlab, where the integration limit can vary
Mostra commenti meno recenti
How to fit an integral with data points in Matlab, where the integration limit can vary
By varying the integration limit how do I fit some data points in Matlab?
5 Commenti
Ameer Hamza
il 3 Nov 2020
Can you show the mathematical formulation of your model?
Suman Karmakar
il 3 Nov 2020
Ameer Hamza
il 3 Nov 2020
You are given the values of P and T, and you want to find these constants?
Suman Karmakar
il 3 Nov 2020
Shobha Gondh
il 13 Gen 2021
My problem is also similar to this fitting so please help.
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).
I have data in x and y and want to find these unknown parameters by fitting.
Thank you
Risposta accettata
Più risposte (1)
Ameer Hamza
il 3 Nov 2020
Modificato: Ameer Hamza
il 3 Nov 2020
One method is to use lsqcurvefit() from Optimization toolbox
Tv = rand(10, 1); % vector of T values
Pv = rand(10, 1); % 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)
2 Commenti
Suman Karmakar
il 3 Nov 2020
Ameer Hamza
il 3 Nov 2020
Yes, it is possible
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);
figure()
axes();
hold on;
plot(Tv, Pv, 'b+', 'DisplayName', 'Experimental Data');
plot(Tv, P_mdl(P0_sol, R_sol, C_sol, Tv), 'r', 'DisplayName', 'Estimated Model');
legend('FontSize', 16, 'Location', 'best')

Categorie
Scopri di più su Linear Predictive Coding in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!