How to fit experimental data on only one ordinary differential equations (out of multiple equations) with multiple unknown parametrs
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Learner
el 3 de Jun. de 2014
Comentada: Johan Sebastian Diaz Tovar
el 21 de Nov. de 2019
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.
Respuesta aceptada
Star Strider
el 4 de Jun. de 2014
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 comentarios
StarSign1997
el 11 de Abr. de 2019
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
el 21 de Nov. de 2019
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.
Más respuestas (1)
Alex Sha
el 25 de Sept. de 2019
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 comentarios
Ver también
Categorías
Más información sobre Interpolation 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!