%%% equ.m: this script defines the system of ODE's that describes the %%% motion ofa pendulum with friction = eps * velocity. %%% requires the driver file phase.m % % The ODE is u''(t) - eps*u'(t) + u = 0 % % We can rewrite this second-order ODE as two first-order equations % by introducing v(t)=u'(t). Matlab needs this system of ODEs written % in the form of a matrix times a vector, so we rewrite the system as % / \ / \ / \ % | 0 1 | | y(1) | | y(1)'| % | | | | --- | | % |-1 eps | | y(2) | --- | y(2)'| % \ / \ / \ / % % where y(1) = u and y(2) = v and yp is the vector containing y(1)' % and y(2)'. % % We define this system as the fuction equ(t,y), which is called in % phase.m function yp = equ(t,y) eps = 1.0e-1; yp = [0.0 1.0; -1.0 eps]*y;