Partial Differential Equation Toolbox | ![]() ![]() |
Solving the Parabolic Equation in Stages
The following example shows you how to solve a parabolic equation in stages and how to set an initial condition as a variable:
pdetool
.
gd sf ns
. Click OK.
g b
. Click OK.
c a f d
. Click OK.
p e t
. Click OK.
save data.mat
at the MATLAB command prompt.
clear all; close all; load data %For the first stage you need to specify an initial condition, U0. U0 = 0; %Note that U0 expands to the correct size automatically. %Divide the time range into 4 stages. time = {0:.01:1, 1:.05:3, 3:.1:5, 5:.5:20}; for i = 1:4 U1 = parabolic(U0,time{i},b,p,e,t,c,a,f,d); for j = 1:size(U1,2) H =pdeplot(p,e,t,'xydata',U1(:,j),'zdata',U1(:,j),'mesh','off'); set(gca,'ZLim',[-80 0]); drawnow end %Reset the initial condition at all points. U0 = U1(:,1); end
![]() | Reducing the Parabolic Equation to Elliptic Equations | The Hyperbolic Equation | ![]() |