What model would fit a set of values that increase then decrease over time?

Trying to model the evolution of a product that is first produced (increase in concentration) then it is consumed/lost (decrease in concentration). Does anyone know which model/equation would fit this set of data?
if true
% code
Days Concentration
0 6.38
1 39.81
2 63.13
3 25.09
6 14.93
9 8.78
12 6.01
15 2.47
18 0.31
end

 Respuesta aceptada

Solving for the second compartment in a two-compartment model comes close.
Model:
[C1] =k1=> [C2] =k3=>
[ ] <=k2= [ ]
First, derive symbolically:
syms C1(t) C2(t) k1 k2 k3 t C10 C20
Eq1 = diff(C1) == C1*k2 - C1*k1;
Eq2 = diff(C2) == C1*k1 - C2*k3;
Csol = dsolve(Eq1, Eq2, C1(0) == C10, C2(0) == 0);
C1 = Csol.C1
C2 = Csol.C2
f = matlabFunction(C2)
Then use fminsearch or another solver to estimate the parameters:
A = [0 6.38
1 39.81
2 63.13
3 25.09
6 14.93
9 8.78
12 6.01
15 2.47
18 0.31];
f = @(in1,t)-(in1(:,1).*in1(:,2).*exp(-in1(:,4).*t))./(-in1(:,2)+in1(:,3)+in1(:,4))+(in1(:,1).*in1(:,2).*exp(-t.*(in1(:,2)-in1(:,3))))./(-in1(:,2)+in1(:,3)+in1(:,4))
b0 = [90 1 1 1];
B = fminsearch(@(b) norm(A(:,2) - f(b,A(:,1))), b0);
xv = linspace(min(A(:,1)), max(A(:,1)));
figure
plot(A(:,1), A(:,2), 'p')
hold on
plot(xv, f(B,xv), '-r')
hold off
grid
The best model describes the system that produced your data.
Experiment to get the result you want.

2 comentarios

Zi Khi’s Answer moved here:
Thanks a million for that!
My pleasure!
If my Answer helped you solve your problem, please Accept it!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 10 de Ag. de 2018

Comentada:

el 10 de Ag. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by