function [out1,out2,out3]=modeldelay(t,x,flag,par)

d=par(1);
n=par(2);

y=zeros(n,1);
y(1)=n*(sin(t)-x(1))/d; 
for i=2:(n)
    y(i)=n*(x(i-1)-x(i))/d; 
end

if nargin <3 | isempty(flag) 
out1=y;
else
    switch(flag)
        case 'init'
            out1  =  [];
            out2  =  [];
            out3  =  [];
        otherwise
            error(['Unknown flag''' flag ''.'])
    end
end