fitting parameters of ode45 using lsqcurvefit
Show older comments
i have problems while running the below coding (i got from Monod kinetics and curve fitting) i have data for C versus time,and at initial conditions, G=G0 and C=0.
function C = eqdeg(B, t,~) % equation codes the system of differential equations describing one % version of solid and liquid phase: % dG/dt = (m.*(Cseq-C))/-Mg; % dC/dt = (m.*(Cseq-C)-k*Ms*C)./Ms; % with: % Variables: x(1) = C, x(2) = G % Parameters: m = B(1), k = B(2), Cseq = 67.811, Mg=-5, Ms=8.5E-5 x0 = B(1:2); [t,CX] = ode45(@DifEq, t, x0); function dC = DifEq(t, x) xdot = zeros(2,1); xdot(1) = (B(1) .* (67.811-x(2))) ./ -5; xdot(2) = ((B(1) .* (67.811-x(2)))-(B(2).*8.5E-5*x(2)))/8.5E-5; dC = xdot; end
i am not sure why i cannot run the coding. perhaps i make a wrong coding. Matlab also did not mention any errors while running. i used R2013a.
i called the function as follows:- [B,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat] = lsqcurvefit(@eqdeg,B0,Time,Cdata);
i am newbie in this field and still not familiar with some terms
thank you in advanced for your time
1 Comment
Jan
on 15 Jun 2015
You mention, that you cannot run this, but do not get an error message. So how do you start it and what happens?
Do you see, that the code is not readable? Use the "{} Code" button for formatting. Thanks.
Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!