Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: simple harmonic oscillator using ode45 function
Posted:
Dec 14, 2012 9:31 AM
|
|
"Shane " <shane_t@hotmail.co.uk> wrote in message news:kaf8sj$q32$1@newscl01ah.mathworks.com... > Hi, > new to matlab and struggling to grasp the language. My problem is I have > been given the equation: > > x" +ax' + bx = f(t) > solved using the ode45 function > > first for f(t) = 0 and then when f(t)= 1 > the point is to study the influence of the variables a and b, I'm sure i > will be comfortable enough to evaluate these myself once I have the code.
You should be able to fairly easily adapt one of the examples from the documentation to solve your specific ODE.
http://www.mathworks.com/help/matlab/math/ordinary-differential-equations.html
In particular, the van der Pol example is already quite close to what you've written.
-- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
|
|
|