How to curve fit following summation equation in MATLAB with given experimental data.

조회 수: 3 (최근 30일)
and
a,k,c,b, and g are constants to be determined.
  댓글 수: 4
abxz
abxz 2019년 11월 12일
@ Kalyan Acharjya, will you please help out with code
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 13일
For assignments or homework, we help only after looking at your efforts to solve the question.

댓글을 달려면 로그인하십시오.

채택된 답변

Alex Sha
Alex Sha 2019년 11월 13일
d(K/ (1+exp(c-b*t)))/dt=k*exp(c-b*t)*b/sqr(1+exp(c-b*t)),so your fitting function become:
eq.png
is the above correct? if yes, you may see the function is over-fit, that means the parameters will not be unique, one solution likes below:
Root of Mean Square Error (RMSE): 11257.9862380487
Sum of Squared Residual: 1647649303.76923
Correlation Coef. (R): 0.891727403408187
R-Square: 0.795177761989108
Adjusted R-Square: 0.726903682652144
Determination Coef. (DC): 0.795103266693536
F-Statistic: 7.64708134900884
Parameter Best Estimate
-------------------- -------------
a 67082.9685482823
k 2.55264230357405E16
c 39.1820152654189
b 0.0511178327965598
g 1.74671169710137E-249
p1.jpg
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 13일
@Alex
Why you are providing the two answers?
You can add the modified answer as a comments in the first answer.
abxz
abxz 2019년 11월 13일
@ Alex Sha, Thanks a lot for your help.
will you please provide the code also.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Alex Sha
Alex Sha 2019년 11월 12일
Hi, Yadav, in your function "a*d/dt(k/1+exp(c-b*t))", what is "d/dt"? does "k/1" equal to "k"? Please describe clearly.
  댓글 수: 4
abxz
abxz 2019년 11월 13일
@Alex Sha , will you please help out with code.
abxz
abxz 2019년 11월 13일
@ Alex Sha , Please send code . I need code so if i have to do similar kind of fitting , i can take the help from the code.
Thank you.

댓글을 달려면 로그인하십시오.


Alex Sha
Alex Sha 2019년 11월 14일
Hi, Yadav, I actually use a software package other than Matlab, named 1stOpt, it is much easy for using without guessing initial start-values, since it adopts global optimization algorithm. The code looks like below:
Parameter a,k,c,b,g;
ConstStr f=a*(k*exp(c-b*t(i))*b)/(1+exp(c-b*t(i)))^2;
Variable t,z[OutPut],y;
StartProgram [Basic];
Sub MainModel
Dim as integer i, j, n
Dim as double temd1, temd2
for i = 0 to DataLength - 1
n = t(i)
temd1 = 0
for j = 0 to n
temd1 = temd1 + f
next
temd2 = 0
for j = 0 to n
temd2 = temd2 + g*y(j)
next
z(i) = temd1 + temd2
Next
End Sub
EndProgram;
Data;
t=[0,2,4,6,8,10,12,14,16,18,20,22,24];
z=[0,0,666.6,5333.33,10666.6,21333,42666.6,4666.6,42666.6,42666.6,42666.6,42666.6,85333.3];
y=[1.25*10^8,1.*10^8,1.25*10^8,2.2*10^10,1.3*10^11,1.4*10^11,1.25*10^11,4.7*10^10,7.9*10^10,9.5*10^10,9.4*10^10,8.8*10^10,9.4*10^10];
a much better result:
Root of Mean Square Error (RMSE): 9901.69220512954
Sum of Squared Residual: 1274565610.8266
Correlation Coef. (R): 0.918681151445272
R-Square: 0.84397505802081
Adjusted R-Square: 0.791966744027747
Determination Coef. (DC): 0.841498837497943
F-Statistic: 9.7840155772957
Parameter Best Estimate
-------------------- -------------
a -277156.527610417
k -10698197.9029827
c 28.5533367811484
b 0.35649699061682
g 3.06293808255498E-8
c231.jpg
  댓글 수: 3
Alex Sha
Alex Sha 2019년 11월 14일
Sorry for giving multi-answers.
1stOpt is an independent software package I think, not the add-in or toolbox of Matlab.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by