# How can I use an ODE solver to solve for the velocities of this system of equations?

1 view (last 30 days)
onamaewa on 2 Jun 2019
I generated this system diagram and have written the system of differential equations below it.
How can I implement an ODE solver to solve for the velocities and plot them vs Frequency? Freq = 1:1000; omega = (2 * pi) * Freq;
time = 1; P0 = 1 * sin(omega * time);
% For this case, since calculations are extensive. Random values are assigned.
Km = 100; Ks1 = 200; Ks2 = 300;
ms = 1; mm = 2;
Rm = 1000; Rs1 = 2000; Rs2 = 3000;
xdds = (1/ms) * (P0 - Rs1 * xds - Ks1 * xs - Rs2 * (xds - xdm) - Ks2 * (xs - xm));
xddm = (1/mm) * (-Rm * xdm - Km * xm + Rs2 * (xds - xdm) + Ks2 * (xs - xm));

darova on 2 Jun 2019
Did you try?
doc ode45
onamaewa on 2 Jun 2019
I did. I’m new to implementing ode solvers. I don’t know what initial conditions or time have to do with this problem.
Bjorn Gustavsson on 2 Jun 2019
For a numerical solution you need to integrate you ODE it with some kind of initial conditions, that is to determine the time-development of and , for some particular run.
The way you pose your question it seems to want your solution as some kind of amplitude of . For that case you wont have all that much help from matlab unless you can solve the equations using the symbolic toolbox. But I suggest you do it by hand, have a look at harmonic expansion, once you understand that concept this is a straightforward task. You will get yourself 2 linear equations (with complex coefficients) to solve. Very simple, somewhat tricky to get the signs and all i^n correct. outside of that - trivial.
HTH