Beruflich Dokumente
Kultur Dokumente
% translate the initial guess into the form that bvp4c can recoganize
solinit=bvpinit(x0,[1 2]);
% call bvp4c to solve the ODE BVP defined by "bvpABfunc" with the boundary
conditions defined by "bvpABbcs"
sol = bvp4c(@bvpABfunc,@bvpABbcs,solinit);
clear;
clc;
%set up the boundaries
xlow=0;
xhigh=1;
%prepare for generation of initial trial solution, and the final solution
N=101; % set up the resolution of trial solution
x0 = linspace(xlow, xhigh, N); % meshing of x
global beta phi; % Define the parameters are used in other functions
beta = 1;
phi = 10;
% call bvp4c to solve the ODE BVP defined by "bvpfunc" with the
% boundary conditions defined by "bvpbcs"
sol = bvp4c(@bvpfunc,@bvpbcs,solinit);
% For detailed use of BVP4C and its options, enter "help BVP4C"
function dydx=bvpfunc(x,y)
% setup the parameters beta and phi
global beta phi;
end
function y0=bvpig(x)
global phi;
sqrtphi=sqrt(phi);
y0(1)=cosh(sqrtphi*(1-x))/cosh(sqrtphi);
y0(2)=-sqrtphi*sinh((1-x)*sqrtphi);
% Example:van der Pol eqns in relaxation oscillation
% Main code
clear; clc;
% where x and t are independent variable (one time-like variable and one
% space-like variable)
% lecture notes
function pdepe5010ex
global u;
m = 2;
x = linspace(0,1,20); % set the lower, upper limits and the mesh number
t = linspace(0,2,10); % set the lower, upper limits and the mesh number
sol = pdepe(m,@pdeex1pde,@pdeex1ic,@pdeex1bc,x,t);
u = sol(:,:,1);
% Use a surface plot to show the complete solution
surf(x,t,u)
figure
xlabel('Distance x')
% --------------------------------------------------------------
alpha = 1.0;
A = 1.0;
c = 1.0;
f = DuDx*alpha;
s = A+B*u;
% --------------------------------------------------------------
u0 = 5;
% --------------------------------------------------------------
pl = 0;
ql = 1/alpha;
pr = ur-5;
qr =