Error NaN genetic algorithm
Show older comments
Hello everyone, I'm totally new with Matlab.
I'm trying to find the minimum of a system of ode45 with a GA for data fitting. I'm using a time dependent parameters inside the differential equations and I implemented the code following the instruction I found on Mathworks with interp1 function. Once the code is running GA found just an NaN as results; I suspect that the problem is caused by the function interp1 but I do not know how to fix it.
Thank you very much for your time
%flow rates
times=dataPR07(:,3);
Feed=9.936e-05*times.^2+0.01176*times+44.3;
Cfeed=-0.007622*times+5.599;
Harv=0.003716*times+47.81;
%function
function dydt = myode(t,y,times,Feed,Cfeed,Harv,mu_max,Ks,Sr,Vr,B,Sm,Sc,Ysx)
F = interp1(times,Feed,t);
C = interp1(times,Cfeed,t);
H = interp1(times,Harv,t);
dydt = zeros(2,1);
dydt(1) = y(1)*(mu_max*((y(2)/(Ks+y(2))))) -((B+Sr)/Vr)*y(1);
dydt(2) = (F*Sm+C*Sc)/Vr - y(2)*(H+B+Sr)/Vr - Ysx*(mu_max*((y(2)/(Ks+y(2)))))*y(1);
end
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!