```From: "Christian Abegglen" <cabegglen@yahoo.com>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webx
Newsgroups: comp.soft-sys.matlab
Subject: assigning initial conditions on PDE solver?
Message-ID: <ef34907.-1@webx.raydaftYaTP>
Date: Tue, 9 May 2006 06:08:32 -0400
Lines: 34
NNTP-Posting-Host: 152.88.164.151
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:348533

Hi
I'd like to model adsorption of a substance onto activated carbon,
using the homogenous surface diffusion model. This model uses a
partial differential equation:
dq/dt = K/r^2 d/dr(r^2 dq/dr)

I can solve this equation easily using pdepe. In the next step, I'd
like to solve this equation in a loop, where the calculated end-state
(q(x, t_end)) should be used as new initial condition.

However, I can't use a vector as initial condition. In the newsgroups
I found exactly my problem. Unfortunately I don't fully understand
its solution, how to use pdeval...
anonymissy, "assigning initial conditions on PDE solver?" #, 11 Mar 2004 12:52 am </WebX?50@@.eed2dac>

I tried the following:

sol = pdepe(m, @pdehsdm, @pdehsdmic, @pdehsdmbc, x, t, [], q_old)
...
function q0 = pdehsdmic(m, x, q_old)
q0 = pdeval(m, x, q_old, xout);

where q_old is a row vector q(t_end, x) and x = linspace(0,R,10).

I know that q0 is a matrix with [q_old, dq_old/dx], but I don't get
to run my program.

Help will be greatly appreciated.