The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Soving PDE using pdepe
Replies: 7   Last Post: Oct 22, 2013 11:05 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 10
Registered: 10/18/13
Soving PDE using pdepe
Posted: Oct 18, 2013 3:25 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I got problem with solving pde using pdepe. Here is my code:

% Neumann boundary conditions (bc2.m)
function [pl,ql,pr,qr] = bc2(xl,ul,xr,ur,t)
pl = [0; 0];
ql = [1; 1];
pr = [0; 0];
qr = [1; 1];
% Initial conditions (initial2.m)
function value = initial2(x);
value = [0.95*x; 0.05*0.5];
% Equations PDE (eqn2.m)
function [c,b,s] = eqn2(x,t,u,DuDx)
c = [1; 1]; % coefficiet of time derivatives
b = [0.001; 0.001].* DuDx; % diffusion terms
s = [u(1)*(1-(u(1)/x)-(1.5)*(u(2)/x));u(2)*(1-(u(2)/0.5)-(1.5)*(u(1)/0.5))]; % Lotka-Volterra 2-species competition model
%Solving PDE stored in eqn2.m, bc2.m, and initial2.m

m = 0;
x = linspace(0,1,1000);
t = linspace(0,1,10000);
sol = pdepe(m,@eqn2,@initial2,@bc2,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);

hold all

This is the Lotka-Volterra competition model with diffusion term (pde). When I try to solve this model with Neumann boundary conditions, I do not get the correct figure i.e. the correct solution of u1 should look like sigmoid curve which start at 0 (when x=0) and finish at 1 (when x = 1). And the correct solution of u2 also looks like sigmoid curve (but in the opposite direction to u1) and it start at 0.5 (when x = 0) and end at 0 (when x = 1).

The initial conditian that should be used is [0.95*x; 0.05*0.5]. And diffusion constant of 0.001.

Thanking you in advance for your help.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.