Runge Kutta solving differential equations

4 visualizaciones (últimos 30 días)
Mj
Mj el 6 de Nov. de 2020
Editada: Samuele Sandrini el 7 de Nov. de 2020
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 comentarios
Mj
Mj el 7 de Nov. de 2020
is it possible for you to send me the code? because i am beginner in matlab.
Alan Stevens
Alan Stevens el 7 de Nov. de 2020
I have not generated any code. If you look at the ode45 help file you will see explanations of what to do.

Iniciar sesión para comentar.

Respuestas (1)

Samuele Sandrini
Samuele Sandrini el 7 de Nov. de 2020
Editada: Samuele Sandrini el 7 de Nov. de 2020
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.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by