MATLAB: Whats wrong with the code

errorpde

function ped1
sol =pdepe(m,@pdefun,@pdeic,@pdebc,xmesh,tspan);
u=sol(:,:,1);
function [c,f,s]= pdefun(x,t,u,DuDx)
c = V/D;
f = DuDx;
s=0;
end
ped1
Undefined function or variable 'V'.
Error in pdefun (line 2)
c = V/D;
Error in pdepe (line 246)
[c,f,s] = feval(pde,xi(1),t(1),U,Ux,varargin{:});
Error in ped1 (line 27)
sol =pdepe(m,@pdefun,@pdeic,@pdebc,xmesh,tspan);

Best Answer

Make pdefun and pdebc nested functions by defining them inside of ped1:
function ped1()
...
V = ...
D = ...
R = ...
...
function [...]= pdefun(...)
...
V/D
...
end
function [...] = pdebc(...)
...
end
end