How do I input and solve a system of differential equations in matlab
36 views (last 30 days)
I have two differential equations that I need to solve using matlab and get plots for them. the two equations are:
m*(d^2x/dt^2) + c*(dx/dt)^2 + (K1)*x + (K2)*x +(K3)*x^3= B*l*i
m, c,K1, K2, K3,B, l, L, and R are all constants E(t)=20 + 5*sin(2t). x and i are both variables. How would I put this into matlab and solve it using ode solvers. Sorry for what is probably such a simple question, I am new to solving ode's with matlab. Thanks for your help.
Sysenso Systems on 20 Apr 2013
Here are some links for solving the differential equations.
Steven Lord on 15 Jan 2021
I recommend you visit the Ordinary Differential Equations category in the documentation. Several of the Topics pages listed in that category show how to start with the mathematical equations for an ODE or a system of ODEs, implement those equations in a form that the ODE solvers can accept, and call the ODE solvers to solve those ODEs.
If after reviewing those sections of the documentation you're still having difficulty with solving your specific system of ODEs please post information about the problem you're trying to solve to Answers or send it to Technical Support for assistance. Some of the information that would be useful:
- Show your system of ODEs (the mathematical form; the button labeled with a Sigma in the Insert section of the toolbar will let you type them in an answer or comment using LaTeX)
- Show how you've tried to implement them
- Describe the difficulty you're experiencing (Are you receiving specific errors or warnings, and if so what is the text of those messages? Does it give a different answer than you were expecting, and if so what answer were you expecting? Etc.)
If you feel a particular section of the documentation is incomplete or unclear please scroll to the bottom of the page and vote on how useful the information was. You will also be able to enter a free text explanation why you chose that rating and there you can call out the incomplete or unclear information.