Fitting Coupled ODE's to Multiple Sets of Experimental Data
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am currently trying to fit a set of coupled kinetic differential equations to to experimentally-obtained data such that:
Where I aim to find values for , , , , and ; I already have obtained values for α, β, , and . In my MATLAB function, I have defined yy which is an n by 3 matrix containing all three sets of X vs. t, S vs. t, and P vs. t data into my function against the ODE45-determined solution. The returned solution should provide the modelled transient behavior for X, S, and P vs. t in the same order as the equations provided above.
B0 = rand(5,1)*100;
[B, Rsdnrm, Rsd, Exflg, OptmInfo, Lmda, Jmat] = lsqcurvefit(@BFERMENT,B0,tt,yy);
function Y = BFERMENT(B,t,~)
%y(1) = X, y(2) = S_lac, y(3) = P_act
%B(1) = mu_max, B(2) = K_s, B(3) = K_i, B(4) = P_m, B(5) = k_d
S0 = 41.8;
X_0 = 0.01;
X0 = [X_0, S0, 0];
tspan = [0 53];
[T,SX] = ode45(@BFERMENTFIT,tspan,X0);
function dydt = BFERMENTFIT(t,y)
%P production model
alpha = 7.1328;
beta = 0.0825;
%S consumption model
Yps = 0.986;
Yxs = 0.093;
dydt = zeros(3,1);
dydt(1) = ((B(1).*y(2))./((1+B(2)./y(2)).*(1+y(2)./B(3)).*(1+(y(3)./B(4)).^4))-B(5)).*y(1);
dydt(3) = alpha.*dydt(1)+beta.*y(1);
dydt(2) = (-1/Yps).*dydt(3)-(B(1)./Yxs).*y(1);
end
if nargin == 2
Y = SX(:,1);
elseif nargin == 3
Y = SX;
end
end
However, whenever I try to run this script with my experimentally-obtained data, it returns an error message saying:
Error using lsqcurvefit. Function value and YDATA sizes are not equal.
Error in Data_Analysis. [B, Rsdnrm, Rsd, Exflg, OptmInfo, Lmda, Jmat] = lsqcurvefit(@BFERMENT,B0,tt,yy);
Would someone be able to help me pinpoint the issue with this? I've been racking my brain for hours trying to figure this out. It would be much appreciated.
7 comentarios
Nikhil Chellam
el 5 de Abr. de 2020
Editada: Nikhil Chellam
el 5 de Abr. de 2020
Star Strider
el 5 de Abr. de 2020
That can occur if ode45 encounters a singularity and then stops its integration, so the output is not the same size as the data (dictated by the size of the ‘tspan’ vector). I have no idea what else could be causing that problem.
Respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!