Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
10 lines (10 sloc) 279 Bytes
function dr=ode4(t,r,k,m)
% first order ODEs for two masses attached by a linear spring
% k is spring stiffness (assume le=0)
% m is mass of each
dr=zeros(size(r));
dr(1)=r(2);
dr(3)=r(4);
dr(2)=r(1).*r(4).^2-2*k/m*r(1);
dr(4)=-2*r(2).*r(4)./(r(1));
end
You can’t perform that action at this time.