Multiple errors while solving a pair of coupled 1-D PDEs

1 view (last 30 days)
I'm failing to solve the following system of equations using MATLAB 7.7.0(R2008b). I've mentioned both code and errors below. Could anyone please suggest what I'm doing wrong?
(gamma)*f*du1/dt - d2u1/dx2 + (gamma)*du1/dx = a*(u1-u2);
(1-f)*du2/dt = a*(u1 - u2)
u1 depends on x,t and u2 depends on u1,t; f=0.7; gamma=60; a=0.065.
Initial conditions
u1(t=0)=0; u2(t=0)=0
Boundary conditions:
at x=0, -u1(input)=-u1+du1/dx;
at x=1; du1/dx=0
u1(input)=1
function [c,b,s] = eqn2(x,t,u,DuDx)
%EQN2: MATLAB M-file that contains the coecents for
%a system of two PDE in time and one space dimension.
c = [42; 0.3];
b = [1; 0] .*DuDx;
s = [60*(0.065*(u(1)-u(2))-DuDx); 0.065*(u(1)-u(2))];
function [pl,ql,pr,qr] = bc2(xl,ul,xr,ur,t)
%BC2: MATLAB function M-file that defines boundary conditions
%for a system of two PDE in time and one space dimension.
pl = [60*(1-ul(1)); 0];
ql = [1; 0];
pr = [0; 0];
qr = [1; 0];
function value = initial2(x)
%INITIAL2: MATLAB function M-file that defines initial conditions
%for a system of two PDE in time and one space variable.
value = [0; 0];
%PDE2: MATLAB script M-file that solves the PDE
%stored in eqn2.m, bc2.m, and initial2.m
m = 0;
x = linspace(0,1,10);
t = linspace(0,1,10);
sol = pdepe(m,@eqn2,@initial2,@bc2,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
subplot(2,1,1)
surf(x,t,u1);
title('u1(x,t)');
xlabel('Distance x');
ylabel('Time t');
subplot(2,1,2)
surf(x,t,u2);
title('u2(x,t)');
xlabel('Distance x');
ylabel('Time t');
Errors:
??? Error using ==> daeic12 at 77 This DAE appears to be of index greater than 1.
Error in ==> ode15s at 395 [y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(odeFcn,odeArgs,t,ICtype,Mt,y,yp0,f0,...
Error in ==> pdepe at 320 [t,y] = ode15s(@pdeodes,t,y0,opts);
Error in ==> Untitled4 at 6 sol = pdepe(m,@eqn2,@initial2,@bc2,x,t);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!