pdepe has expectations for the initial condition function. Namely, that it will use the functional signature:
function u0 = icfun(x)
In other words, pdepe expects this function to take 1 input, x. If you want to use another variable in the body of this function, then you need to do two things.
- Write the function with two inputs rather than one
- Pass the function to pdepe as an anonymous function that takes 1 input as pdepe expects
For example:
function T0 = heatic(x,T00)
T0 = T00; %%dimensionless initial temperature
end
and the call to the solver becomes
sol = pdepe(m,@heatpde,@(x) heatic(x,T00),@heatbc,x,t);
Notice that this anonymous function has 1 input, x. But whenever that anonymous function is called, it is supplied with the value of T00 from the workspace.