# runge kutta for 2 order ODE

16 vues (au cours des 30 derniers jours)
Rio Bratasena le 3 Nov 2022
how can I solve this equation
with runge kutta method
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (2)

Hiro Yoshino le 3 Nov 2022
Let us assume that and re-write the problem as follows:
Let's transform it so it can be used in an ode setting:
These are used in the function (vdp1) as follows:
solve this the time interval of [0 10] with initial values of [0.2 0] for x_1, x_2 respectively.
[t,x] = ode45(@vdp1,[0 10],[0.2 0])
t = 89×1
0 0.0001 0.0003 0.0004 0.0005 0.0011 0.0018 0.0024 0.0030 0.0062
x = 89×2
0.2000 0 0.2000 -0.0001 0.2000 -0.0001 0.2000 -0.0002 0.2000 -0.0002 0.2000 -0.0005 0.2000 -0.0007 0.2000 -0.0010 0.2000 -0.0012 0.2000 -0.0024
plot(t,x(:,1),'-o',t,x(:,2),'-o')
title('Solution with ODE45');
xlabel('Time t');
ylabel('Solution x');
legend('x_1','x_2');
function dxdt = vdp1(t,x)
% ODE
dxdt = [x(2); -2*(x(2)+x(1))];
end
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Sam Chak le 3 Nov 2022
Assuming that the symbol is the Dirac impulse. please check if the following responses are expected when you run it with the Runge-Kutta solver.
A = [0 1;
-2 -2];
B = [0; 0.2];
C = eye(2);
D = [0; 0];
sys = ss(A, B, C, D);
impulse(sys)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Runge Kutta Methods dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by