function dzdt=fp2eq(t,z,a,c,f,omega) %FP2EQ Forced pendulum equations (version 2). % DZDT=FP2EQ(T,Z,A,C,F,OMEGA) evaluates % % dx/dt = y % dy/dt = -(A^2 + F*cos(OMEGA*t))*sin(x) - C*y % % at (x,y)=Z and t=T. % Francisco J. Beron-Vera, 2006/10/09 n=length(z); dzdt=zeros(n,1); x=z(1:2:end-1); y=z(2:2:end); dzdt=[y;-(a^2+f*cos(omega*t))*sin(x)-c*y]; dzdt=reshape(dzdt,[n/2 2])'; dzdt=dzdt(:);