function [x y]=traj(A,B,alpha,fps,frames,S0) %Initialise Parameters %fps and frames are declared as global variables t=0:(1/fps):(frames/fps); %Time points x_0=S0(1,1); y_0=S0(1,2); x=zeros(length(t),1); y=zeros(length(t),1); Ax=A(1,1); Ay=A(1,2); Bx=B(1,1); By=B(1,2); for n=1:length(t) x(n) = x_0 + Ax.*t(n) - ((Bx-Ax)/alpha).*exp(-alpha*t(n)) + ((Bx-Ax)/alpha); y(n) = y_0 + Ay.*t(n) - ((By-Ay)/alpha).*exp(-alpha*t(n)) + ((By-Ay)/alpha); end; plot(x,y);