15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5 Differential Equations<br />

dydt(i+1,:) = 3*y(i,:) - y(i+1,:).*y(i,:).^2 + ...<br />

c*(y(i-1,:)-2*y(i+1,:)+3);<br />

end % End nested function f<br />

end % End function brussode<br />

% --------------------------------------------------------------<br />

function S = jpattern(N)<br />

B = ones(2*N,5);<br />

B(2:2:2*N,2) = zeros(N,1);<br />

B(1:2:2*N-1,4) = zeros(N,1);<br />

S = spdiags(B,-2:2,2*N,2*N);<br />

end;<br />

The Brusselator for N = 20<br />

3<br />

2.5<br />

2<br />

solution u<br />

1.5<br />

1<br />

0.5<br />

0<br />

10<br />

8<br />

6<br />

time<br />

4<br />

2<br />

0<br />

0<br />

0.2<br />

0.4<br />

space<br />

0.6<br />

0.8<br />

1<br />

Example: Simple Event Location<br />

ballode models the motion <strong>of</strong> a bouncing ball. This example illustrates the<br />

event location capabilities <strong>of</strong> the ODE solvers.<br />

5-28

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

Saved successfully!

Ooh no, something went wrong!