Runge Kutta solving differential equations

조회 수: 3 (최근 30일)
Mj
Mj 2020년 11월 6일
편집: Samuele Sandrini 2020년 11월 7일
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
Mj 2020년 11월 7일
is it possible for you to send me the code? because i am beginner in matlab.
Alan Stevens
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
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:
  1. starting from your second order equation, in general like this: , you take two auxiliary variable and .
  2. 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.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by