How to solve the parameters of a diffusion model?

t= 0 5 10 15 20 30 45 60 75 90 105 120
qt= 0 3.87 4.62 4.98 5.21 5.40 5.45 5.50 5.51 5.52 5.54 5.53

6 Comments

1: First of all, from your second equation, there are series solutions for qn, for example qn=[4.35378367056498, 7.48808641357782, 10.5751624468592, 13.6511427168261,...], so taking different value of qn will lead to different result in the next step.
2: if taking qn=4.35378367056498 into first equation, the fitting result will be:
Sum Squared Error (SSE): 0.23048903563446
Root of Mean Square Error (RMSE): 0.138590835325446
Correlation Coef. (R): 0.99579970928735
R-Square: 0.99161706101677
Parameter Best Estimate
--------- -------------
n 15
qe 5.43511155362024
d 0.0114940264188371
3: if taking qn=7.48808641357782 into first equation, the fitting result will be:
Sum Squared Error (SSE): 0.231537368020569
Root of Mean Square Error (RMSE): 0.138905653838787
Correlation Coef. (R): 0.995797614899306
R-Square: 0.991612889839147
Parameter Best Estimate
--------- -------------
n 15
qe 5.43578699037023
d 0.00386345002066533
The qi > 0 have to be ordered as 0 < q1 < q2 < q3 < ... < qi < ... and then used as written in the series.
So not a single value of the qi has to be taken, but the ordered sequence of the qi.
Qili Hu
Qili Hu on 19 Apr 2023
Edited: Qili Hu on 19 Apr 2023
Dear Sha
Thanks for your answer. Can you give me original program codes? Thank you very much.
Qili Hu
huqili@cdut.edu.cn
Hi, Torsten, you are right, I miss understanding the meanings of qn, after modification, the result will be:
Sum Squared Error (SSE): 0.110928562180473
Root of Mean Square Error (RMSE): 0.0961459663655878
Correlation Coef. (R): 0.998042020290086
R-Square: 0.996087874264717
Parameter Best Estimate
--------- -------------
n 16
qe 5.77455887169259
d 0.000526273425478496
Dear Sha
Thank you for your answer. I don't know how to write codes of this question. Can give me original MATLAB codes. Thank you very much.
Qili Hu
huqili@cdut.edu.cn
Hi, Hu:
Step 1: finding the series root of qn (n=1,2,3...,) using fsolve or vpasolve one by one,alternatively, you may think other methods to quickly find solutions for different intervals together;
Step 2: based on the solutions from step 1, it is easy to use command, for example lsqcurvefit, to achieve the next fitting procedure.
The first 33 roots are given below, obtained very easy by using 1stOpt (a math package other than Matlab)
n=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33];
qn=[4.35378367052701,7.48808641354398,10.5751624468592,13.6511427168261,16.7257079845738,19.8025583223684,22.8832678483399,25.9684490866884,29.0582237629463,32.1524537034099,35.2508675693218,38.3531340595364,41.4589045596711,44.5678374146667,47.6796109564883,50.7939296792504,53.9105263205883,57.0291615831204,60.1496225761141,63.2717206388126,66.3952889411584,69.520180089537,72.6462638614857,75.7734251293724,78.9015619953762,82.0305841384314,85.1604113617219,88.2909723238772,91.4222034345828,94.5540478954731,97.6864548680592,100.819378752091,103.952778559431];
You may then try the remain fitting process yourself.

Sign in to comment.

 Accepted Answer

Torsten
Torsten on 13 Apr 2023
Edited: Torsten on 13 Apr 2023
  1. Make a code to determine the roots of your second equation.
  2. Make a code that evaluates the infinite sum to determine q_t from your first equation.
  3. Use MATLAB's "lsqcurvefit" to fit your parameters.

4 Comments

Dear Torsten
Thanks for your warm work. I mean I want to obtain the values of the undetermined parameters by MATLAB program codes. How to obtain these parameters by correlating the diffusion model with a set of (t, qt)? I hope I can receive your response again. Thank you very much.
Torsten
Torsten on 17 Apr 2023
Edited: Torsten on 17 Apr 2023
Please include your code so far to
  1. Make a code to determine the roots of your second equation.
  2. Make a code that evaluates the infinite sum to determine q_t from your first equation.
  3. Use MATLAB's "lsqcurvefit" to fit your parameters.
Dear Torsten
Thanks for your warm work. Can you give me original program codes? Thank you very much.
Qili Hu
huqili@cdut.edu.cn
We will not provide the code for you. However, we will assist you in correcting your attempt at the code once you have posted your attempted version.

Sign in to comment.

More Answers (0)

Asked:

on 13 Apr 2023

Commented:

on 21 Apr 2023

Community Treasure Hunt

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

Start Hunting!