Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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 ]
Torsten

Posts: 1,450
Registered: 11/8/10
Re: Soving PDE using pdepe
Posted: Oct 18, 2013 6:09 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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))]; % Lotka-Volterra 2-species 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 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.


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.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.