Filter löschen
Filter löschen

Solve an ODE with runge kutta method

7 Ansichten (letzte 30 Tage)
Luke
Luke am 25 Mär. 2011
Hi,
I'm trying to solve the following eqaution using runge kutta method. I have not seen any examples of ODE45 or ODE15s for equations in this type.
Ay''+Byy'+Cy'+Dy+E=0; where A,B,C,D and E are constants.
Boundary conditions are y(0)=0; y(l)= 2.3
Thanks

Akzeptierte Antwort

Jarrod Rivituso
Jarrod Rivituso am 25 Mär. 2011
Ah, the glory of state-space. First, make the substitution
u = y'
Then, you have a system of two equations
u' = (1/A)*(-B*y*u-C*u-D*y-E)
y' = u
Now you can use ode45...
>> [t,y] = ode45(@xdot,[0 1],[0;0]);
where the function xdot is...
function dx = xdot(t,x)
A = 1;
B = 1;
C = 1;
D = 1;
E = 1;
u = x(1);
y = x(2);
dx(1,1) = (1/A)*(-B*y*u-C*u-D*y-E);
dx(2,1) = y;
Note that I didn't really understand your initial conditions. For your differential equation, you would need to specify an initial y and y', I believe.

Weitere Antworten (1)

Jan
Jan am 25 Mär. 2011
If you have "boundary conditions", you need a different solver, see bvp4c and bvp5c. But two conditions are not enough to find a solution for of 2nd order ODE - you need an additional condition.
  1 Kommentar
Luke
Luke am 29 Mär. 2011
I solved this equation with bvp4c. But it takes so long to give me an answer. The people who worked on a similar equation suggested to use a Runge-Kutta Nystrom Method, which I'm not familier. Are you guys conversant with this method?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by