Dear Star Strider,
thank you for your response. Unfortunatelly, I haven't solve my problem yet. I applied your scripts, as you advised me. At first, they responsed but the results weren't logical. After some runs (playing with the initial conditions) there were no results. And now there is this message:
Error using lsqcurvefit (line 248)
Function value and YDATA sizes are not equal.
Error in MonodKinetics1_test (line 11)
[v,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat] = lsqcurvefit(@MonodKinetics1,v0,tdata,Ydata);
The scripts are the following:
The function:
function Y = MonodKinetics1(v, t)
y0 = rand(4,1)*1000;
[T,Yv] = ode45(@DifEq, t, y0);
function dS = DifEq(t, y)
dy=zeros(4,1);
N=y(1)+y(2)+y(3)+y(4);
dy(1)=-v(1)*y(1)*y(3)/N-v(2)*y(1);
dy(2)=v(1)*y(1)*y(3)/N-v(3)*y(2)-v(4)*y(2)*y(3)/N-v(5)*y(2);
dy(3)=v(2)*y(1)+v(3)*y(2)+v(4)*y(2)*y(3)/N-v(6)*y(3);
dy(4)=v(5)*y(2)+v(6)*y(3);
dS = dy;
end
Y = Yv(:,1);
end
and I run script:
load R_data.dat
format long
tdata=R_data(:,1);
Ydata=R_data(:,2:5);
v0 = rand(6,1);
[v,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat] = lsqcurvefit(@MonodKinetics1,v0,tdata,Ydata);
The data are described adove (first message).
Could you help me more, please?
I apprecciate everydoby who help me to continue with my project.
Thanks
Best Answer