Numerically integrate a time dependent differential equation
古いコメントを表示
Hi - I need to numerically integrate this equation: dCDF/dt=1/tr where tr = t0 * exp(bP/Tc). t0, b, and P are constants and Tc is defined as: Tc= {Te^4+K * [307.59-190.96 (ln〖t/24〗 )^0.24 ]}^(1/4) where Te, K are constants and t is changing between 1 to 300 days. The initial condition is CDF = 0 at t=ti. I want to integrate the dCDF/dt=1/tr in the forward time direction starting from t=ti until the CDF approach a finite value of 0.05. I appreciate your help.
3 件のコメント
Torsten
2022 年 12 月 1 日
What is the unit for t in your expression for Tc ? hours ? days ?
Alireza Mofidi
2022 年 12 月 1 日
Torsten
2022 年 12 月 1 日
Then my answer below should be correct.
回答 (1 件)
bP = 1;
Te = 1;
K = 1;
t0 = 1;
ti = 24;
CDF = @(x)integral(@(t) 1/t0*exp(-bP./(Te^4+K*(307.59-190.96*(log(t/24)).^0.24)).^0.25),ti,x)
x = ti:ti:300*ti;
F = arrayfun(@(x)CDF(x),x)
plot(x,F)
4 件のコメント
Alireza Mofidi
2022 年 12 月 1 日
Torsten
2022 年 12 月 1 日
You must supply the parameters used in the equation. Then CDF can be computed automatically.
I don't know what you mean by "how can I solve the equation iteratively in a for loop until the CDF value approach the value of 0.05". You solve a differential equation for CDF - there is no need for a for loop or iteration. The solution can be computed as done above.
Torsten
2022 年 12 月 2 日
@Alireza Mofidi comment moved here:
Yes, I understand. But what I'm looking for is to find out at which "t" the CDF will approach 0.05. I think my question was confusing.
Torsten
2022 年 12 月 2 日
As you can see, with the parameters I used for bP ,Te, K and t0, CDF tends to infinity as time grows. Insert the "correct" empirical parameters, run the code again and check the CDF curve shown. If it does not behave as you expect, recheck your model.
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
