function [E]=osc_res(par,td,yd)

a=par(1);
b=par(2);
c=par(3);
d=par(4);
e=par(5);

yf=a*sin(b*(td-c)) + d*td + e; % y-values on the fitted curve

E=sum((yd - yf).^2); % quantity to be minimized is the 2-norm squared

end

