Runge Kutta solving differential equations

2 次查看(过去 30 天)
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