# MATLAB Second order nonlinear differential equation

• Dec 15th 2008, 05:04 PM
math112
MATLAB Second order nonlinear differential equation
d2θ/dt2 + c/(mL)dθ/dt + (g/L)sin(θ) = 0

c/(mL)=.5
(g/L)=2

Initial Conditions:
θ(0)=pi/2
θ'(0)=pi/2

How can this be solved in MATLAB. I am new to it and still not very good. Would ode solvers work? What other possible functions can I use? What does the code look like?
• Dec 15th 2008, 05:17 PM
Matlab's ode solvers can only be used if you want to evaluate the solution at a specific point or a number of specific points. If you want an equation for the solution, you should take a look at the dsolve function.
• Dec 15th 2008, 07:00 PM
CaptainBlack
Quote:

Originally Posted by math112
d2θ/dt2 + c/(mL)dθ/dt + (g/L)sin(θ) = 0

c/(mL)=.5
(g/L)=2

Initial Conditions:
θ(0)=pi/2
θ'(0)=pi/2

How can this be solved in MATLAB. I am new to it and still not very good. Would ode solvers work? What other possible functions can I use? What does the code look like?

The ode solvers will give a numerical solution once you convert this into a first order system. See this thread.

CB