ODE45, differential equation
古いコメントを表示
my function is
dy/dt=k*y*exp(450/y)
k is constant and y(0)=40 and y(15)=95 solve this equation by using ode45 can someone pleaseeeeeeeeeee check the code and make it work .
tspan = [0 300];
y0 = 40;y15=95
[t,y] = ode45(@(t,y) 'k'*y*exp(450/y), tspan, y0,y15);
plot(t,y,'-o')
採用された回答
その他の回答 (3 件)
James Tursa
2018 年 9 月 15 日
0 投票
Remove the quotes from 'k', and be sure to define k before you call ode45. Also, ode45 is an initial value problem solver, so the y15 variable is not applicable (remove it from the call).
9 件のコメント
Takey Asaad
2018 年 9 月 15 日
James Tursa
2018 年 9 月 15 日
Oh, I misunderstood. Since you are solving for k, this is not an initial value problem and ode45 is not the appropriate tool to use as I have outlined it. You might look at the boundary value problem link here:
And read the discussion following:
"The bvp4c solver can also find unknown parameters p for problems of the form ..."
Takey Asaad
2018 年 9 月 15 日
James Tursa
2018 年 9 月 15 日
You need to make an attempt at this. Look at the example involving an unknown parameter, and try to use that as an outline for your equation.
Takey Asaad
2018 年 9 月 15 日
James Tursa
2018 年 9 月 15 日
Please post your current code and let us know what specific problems you are having with it.
Takey Asaad
2018 年 9 月 15 日
編集済み: James Tursa
2018 年 9 月 17 日
Takey Asaad
2018 年 9 月 15 日
編集済み: James Tursa
2018 年 9 月 17 日
Takey Asaad
2018 年 9 月 15 日
編集済み: James Tursa
2018 年 9 月 17 日
Takey Asaad
2018 年 9 月 15 日
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
