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.

Partial Differential Equations<br />

b Display a solution pr<strong>of</strong>ile at t f , the final value <strong>of</strong> t. In this example, t f =<br />

c<br />

2. See “Evaluating the Solution at Specific Points” on page 5-99 for more<br />

information.<br />

figure<br />

plot(x,u(end,:))<br />

title('Solution at t = 2')<br />

xlabel('Distance x')<br />

ylabel('u(x,2)')<br />

0.14<br />

Solution at t = 2<br />

0.12<br />

0.1<br />

0.08<br />

u(x,2)<br />

0.06<br />

0.04<br />

0.02<br />

0<br />

−0.02<br />

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1<br />

Distance x<br />

Evaluating the Solution at Specific Points<br />

After obtaining and plotting the solution above, you might be interested in a<br />

solution pr<strong>of</strong>ile for a particular value <strong>of</strong> t, or the time changes <strong>of</strong> the solution<br />

at a particular point x. The kth column u(:,k) (<strong>of</strong> the solution extracted in<br />

step 7) contains the time history <strong>of</strong> the solution at x(k). The jth row u(j,:)<br />

contains the solution pr<strong>of</strong>ile at t(j).<br />

Using the vectors x and u(j,:), and the helper function pdeval, you can<br />

evaluate the solution u and its derivative ∂u ⁄ ∂x at any set <strong>of</strong> points xout<br />

[uout,DuoutDx] = pdeval(m,x,u(j,:),xout)<br />

5-99

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

Saved successfully!

Ooh no, something went wrong!