Runge-Kutta method related
2 次查看(过去 30 天)
显示 更早的评论
Hi
I have a doubt (rather a confusion) in Ruge-Kutta method. I want to time integrate an equation of the form
dy/dt = g*n-0.5*(u^2+v^2)
Where g,n,u and v are known. So I can put equation in the form
dy/dt = a constant
I want to time integrate it in the time span [ti tf]. As the equation have constant on right side and no time, no y variable, how I can time integrate it? I have initial conditions for y. If I use ode45 how I can call ode45? How the equation should be fed to ode45?
Thanks in advance
Sreenu
0 个评论
采纳的回答
Richard Brown
2012-5-9
Why are you bothering to use ode45 at all?
Your solution for any t >= ti is just
y = y0 + (t - ti) * (g*n-0.5*(u^2+v^2));
4 个评论
更多回答(1 个)
Jan
2012-5-8
Did you read the documentation for ODE already? There is a nice example, which you can modify easily.
2 个评论
Jan
2012-5-9
编辑:Jan
2012-8-19
Please post how you have implemented the function to be integrated and explain "not satisfying" with any details. The solution seems to be trivial: function dy=myFunc(y, t) dy = 15.3; % Or what ever the constant value is
You can integrate the function dy/dt=K in closed form also.
Perhaps you are looking for an anonymous function to define the constant value externally. Then see: http://www.mathworks.com/matlabcentral/answers/1971-when-using-ode45-or-similar-functions-what-is-the-benefit-of-using-anonymous-functions-over-passi Another idea is to search for the term "ODE45" in this forum.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!