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 />

Note See the function_handle (@), func2str, and str2func reference pages,<br />

and the “Function Handles” chapter <strong>of</strong> “Programming and Data Types” in the<br />

<strong>MATLAB</strong> documentation for information about function handles.<br />

7 View the results. Complete the example by displaying the results:<br />

a<br />

Extract and display the first solution component. In this example, the<br />

solution u has only one component, but for illustrative purposes, the<br />

example “extracts” it from the three-dimensional array. The surface plot<br />

shows the behavior <strong>of</strong> the solution.<br />

u = sol(:,:,1);<br />

surf(x,t,u)<br />

title('Numerical solution computed with 20 mesh points')<br />

xlabel('Distance x')<br />

ylabel('Time t')<br />

Numerical solution computed with 20 mesh points.<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

2<br />

1.5<br />

1<br />

Time t<br />

0.5<br />

0<br />

0<br />

0.2<br />

0.4<br />

Distance x<br />

0.6<br />

0.8<br />

1<br />

5-98

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

Saved successfully!

Ooh no, something went wrong!