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: pdepe solver: pass extra parameters K3
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Zuhair

Posts: 8
Registered: 10/18/13
pdepe solver: pass extra parameters K3
Posted: Jul 14, 2014 2:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi all,

I am trying to solve my model by passing one additional parameters K3 into pdepe solver. I follow the approach discussed by Jacek Kierzenka in this this forum:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/162627

But I keep getting error message: "Error using vertcat. Dimensions of matrices being concatenated are not consistent". Can anyone please help me to point out what is my mistake? Here is my code:

function [pl,ql,pr,qr] = bc2(xl,ul,xr,ur,t,K3)
pl = [0; 0; 0];
ql = [1; 1; 1];
pr = [0; 0; 0];
qr = [1; 1; 1];
----------------------------------------------------
function [c,b,s] = eqn2(x,t,u,DuDx,K3)
global a m1 b2 ic1 ic2 ic3
c = [1; 1; 1]; % coefficiet of time derivatives
b = [0.001; 0.001; 0.001].* DuDx; % diffusion terms
s = [...
u(1)*(1-(u(1)/(m1*x))-(a)*(u(2)/(m1*x))-(a)*(u(3)/(m1*x)));...
u(2)*(1-(u(2)/b2)-(a)*(u(1)/b2)-(a)*(u(3)/b2));...
u(3)*(1-(u(3)/(K3))-(a)*(u(1)/(K3))-(a)*(u(2)/(K3)))];
------------------------------------------------------
function value = initial2(x,K3);
global a m1 b2 ic1 ic2 ic3
value = [ic1.*(m1*x); ic2.*b2; ic3*K3];
-------------------------------------------------------
global a m1 b2 ic1 ic2 ic3

a = 0.8;
m1 = 10;
b2 = 40;

ic1 = 0.5;
ic2 = 0.9;
ic3 = 0.3;
m = 0;
x = linspace(0,10,1001); %2001
K3 = 20.*x-80;
K3(1:401) = 0;
t = 0:1:1000; % 1000
sol = pdepe(m,@eqn2,@initial2,@bc2,x,t,[],K3);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
u3 = sol(:,:,3);

Cheers
Zuhair



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.