function sol = exer6 % exer6, exer6f, exer6h of tutorial. % Sample problem of ARCHI manual. The absolute error % tolerance is set to 1e-9 to illustrate the use of % options. Also, it is necessary to use the InitialY % option because the solution is not continuous at the % initial point. options = ddeset('AbsTol',1e-9,'InitialY',[0; 0]); sol = dde23(@exer6f,[1, 2],@exer6h,[0, 4],options); plot(sol.x,sol.y) title('Sample Problem of ARCHI Manual.') xlabel('time t'); ylabel('y(t)'); %================================================= function yp = exer6f(t,y,Z) ylag1 = Z(:,1); ylag2 = Z(:,2); yp = [ ylag1(1)*ylag2(2) -y(1)*ylag2(2) ]; %================================================= function y = exer6h(t) y = [cos(t); sin(t)];