How to solve runge kutta using implicit method
显示 更早的评论
hey guys I am trying to write a script using runge kutta implicit method 4th order I got the following equations
for n =2:(N-1)
k_1 = f(tout(n-1) +(0.5+(sqrt(3)/6)*h) , yout(:,n-1) + 0.25*h*k_1 + (0.25 + (sqrt(3)/6))*h * k_2);
k_2 = f(tout(n-1) +(0.5-(sqrt(3)/6)*h) , yout(:,n-1) + (0.25-(sqrt(3)/6))*h*k_1 + 0.25*h * k_2);
yout(:,n) = yout(:,n-1) + (h/2)*(k_1 + k_2);
end
but to find k_1, I need a value for k_1 and to find k_2 I need a value for k_2
how I am supposed to do it? Didn't undestrand implict method...
回答(2 个)
Sara
2014-5-30
0 个投票
Implicit means the equation has no analytic solution, i.e. you'll have to solve it iteratively. Meaning, you try guessing the value of your unknown, plug it into your equation and see if the right side is equal to the left side. In your case, for each iteration, you'll have to solve a system of algebraic equations. You can use fsolve for that, just rewrite your equations in k_1 and k_2 in the form f = (right side)-(left side)
类别
在 帮助中心 和 File Exchange 中查找有关 Runge Kutta Methods 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!