% Iserles' 1994 example
% z'(t) = -0.25*z(t) + z(t/2)*(1-z(t/2)), 
% z(0)=0.5, on 0 <= t <= 10^5
tend = 10^3;
sol  = ddesd( @(t,y,z) -0.25*y + z.*(1-z), @(t,y) t/2, 0.5, [0,tend] );
t    = linspace(0,tend,3*tend+1);
[y,yp] = deval( sol, t );
t2 = t/2;
y2 = deval( sol, t2 );
r2 = yp - (-0.25*y + y2.*(1-y2) );
figure
plot( t, y, 'k' )
set(gca,'fontsize',16);
xlabel('t','fontsize',16);
ylabel('y','fontsize',16);
figure
plot( t, r2, 'k' )
set(gca,'fontsize',16);
xlabel('t','fontsize',16);
ylabel('residual','fontsize',16);