Runge Kutta solving differential equations
이전 댓글 표시
Hello everyone!
I have to solve this second order differential equation by using the Runge-Kutta method in matlab:
can anyone help me please? and how can i plot the figure?(a against e)
d2a/de2=(((((2+c2)*(Fu^2))/(1+c2))+1)*(a^c2)-((2+c2/1+c2)*(Fu^2/a))-a^(2+(2*c2)))/(((2+c2)*Fu^2)/(1+c2)*(3+c2));
Fu=1
c2=0 , 0.5 , 1 (there are 3 values for c2)
initial conditions are: a=0.8 , d_a=0
댓글 수: 4
Mj
2020년 11월 7일
Alan Stevens
2020년 11월 7일
Turn the second order ode into two first order ode's, and use one of Matlab's ode solvers, e.g. ode45 (type doc ode45 in the command window for details)
Mj
2020년 11월 7일
Alan Stevens
2020년 11월 7일
I have not generated any code. If you look at the ode45 help file you will see explanations of what to do.
답변 (1개)
Samuele Sandrini
2020년 11월 7일
편집: Samuele Sandrini
2020년 11월 7일
Hi, i'm sorry but your differential equation is unreadable in that way.
However i try to give you all element that you need; as already told by @Alan Stevens, first of all you have to pass from a second order diff. eq. to a system of two first order diff. equation, in this way:
- starting from your second order equation, in general like this:
, you take two auxiliary variable
and
. - After that you can rewrite the first equation like:

Note that the first equation in the system is always the same, the second one corrispond to y'' and is equal to the starting equation where y and y' is replaced by
e
.
Once you obtained the system, programmaticaly you can do something like this:
f = @(z,t) [z(2); ...(the second eqn in the system using z(1) end z(2)) ];
[t,y] = ode45(f,[t0 tF],[y(0);y'(0)]) %where y(0) and y'(0) are the initial condition (in your case [0.8;0])
Note that y will be a matrix with two column that corrispond respectively to
and
.
If you want an example here you can find in Examples paragraph, the second one is the solution of the van der Pol equation that is similar to this procedure.
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!