Zuhair
Posts:
10
Registered:
10/18/13


Re: Soving PDE using pdepe
Posted:
Oct 18, 2013 11:45 AM


Yes, I tried it before. When I used the usual form which include the term "r" (growth rate), it is almost the same answer to what I got with the code above. What I do to this model is that I nondimensionalize the pde first and I get rid of the term r.
But when I nondimensionalize the differential equations, should I nondimensionalize the boundary and initial conditions too? Is it correct the way I specify the Neumann boundary conditions for u1 and u2 in the above code?
Thank you.
"Torsten" wrote in message <l3r1c1$7pt$1@newscl01ah.mathworks.com>... > "Zuhair" wrote in message <l3qnoi$il5$1@newscl01ah.mathworks.com>... > > Hi > > > > 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))]; % LotkaVolterra 2species competition model > >  > > %Solving PDE stored in eqn2.m, bc2.m, and initial2.m > > close > > clear > > clc > > > > 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); > > > > plot(x,u1(end,:)); > > hold all > > plot(x,u2(end,:)); > > xlabel('x') > > ylabel('u(x)') > > > > This is the LotkaVolterra 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. > > Did you try what you get when you use the usual form for the source term given under > http://en.wikipedia.org/wiki/Competitive_Lotka%E2%80%93Volterra_equations > subtitle "Two species" ? > > Best wishes > Torsten.

