How to fit experimental data on only one ordinary differential equations (out of multiple equations) with multiple unknown parametrs
8 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to estimate 3 unknown parameters that exist in 3 ordinary differential equations (ODEs) by fitting it to experimental data of only one ODE.
My equations are:
dy1/dt = (c(1)*y1.^2) + (c(2)*(y2)) - (c(3)*y3);
dy2/dt = (c(3)*y3) + (c(4)*y1);
dy3/dt = (c(1)*y1.^2) - (c(5)*y2) + (c(3)*y3);
My experimental 'x-axis data (time axis)' and 'y-axis data' for dy3/dt is as follows:
xdata = [0 1 2 3 4 5 6 7 8 9];
ydata = [3 17 9 4 8 2 1 9 2 4].
Starting guess of unknown parameters: c(1), c(2), c(3) i.e.
c0 = [1, 1, 1]; where c(4) and c(5) are known = 2 and 1.5.
Thanks in advance.
采纳的回答
Star Strider
2014-6-4
The strategy is to put your differential equation and the ODE solver call inside the objective function you want to fit. It integrates the equations with the parameters passed to it, and returns the solved equation as the output of the objective functions. You can specify that c(4) and c(5) are known inside the objective function file, and only fit c(1)...c(3). Specify the initial conditions inside the objective function, or you can also fit them as parameters if you wish. (I’ve done all those.)
With a vector output, you can use nlinfit, lsqcurvefit, or with an extra step, fminsearch to do the fit.
14 个评论
StarSign1997
2019-4-11
I copied and pasted the code here but an error occurs saying function value and YDATA are not equal in size. I am confused.
Johan Sebastian Diaz Tovar
2019-11-21
StarSign1997 when copy the code make sure to take the transpose of Sdata, if you don't do that, you'll get that error. So: Sdata = Sdata'; Doing this you solve that.
regards.
更多回答(1 个)
Alex Sha
2019-9-25
How about the results below:
Root of Mean Square Error (RMSE): 2.11836006576677
Sum of Squared Residual: 40.3870443141185
Correlation Coef. (R): 0.897567768947133
R-Square: 0.805627899852735
Adjusted R-Square: 0.740837199803646
Determination Coef. (DC): 0.805415739385938
F-Statistic: 4.2201395530756
Parameter Best Estimate
-------------------- -------------
c1 -0.607049737407678
c2 -1.63508159310052
c3 -0.00144177544567964
y1 Initial Value -8.12681195260699
y2 Initial Value -25.9407402385313
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!