15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Initial Value Problems for DDEs<br />

dydt = [ylag1(1)<br />

ylag1(1) + ylag2(2)<br />

y(2) ];<br />

4 Code the history function. The history function for this example is<br />

function S = ddex1hist(t)<br />

S = ones(3,1);<br />

5 Apply the DDE solver. The example now calls dde23 with the functions<br />

ddex1de and ddex1hist.<br />

sol = dde23(@ddex1de,lags,@ddex1hist,[0,5]);<br />

Here the example supplies the interval <strong>of</strong> integration [0,5] directly. Because<br />

the history is constant, we could also call dde23 by<br />

sol = dde23(@ddex1de,lags,ones(3,1),[0,5]);<br />

6 View the results. Complete the example by displaying the results. dde23<br />

returns the mesh it selects and the solution there as fields in the solution<br />

structure sol. Often, these provide a smooth graph.<br />

plot(sol.x,sol.y);<br />

title('An example <strong>of</strong> Wille'' and Baker');<br />

xlabel('time t');<br />

ylabel('solution y');<br />

legend('y_1','y_2','y_3',2)<br />

5-55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!