How to insert initial condition
9 views (last 30 days)
Show older comments
Hello everybody, I trying to solve cable equation with PDE solver i would like to add punctually a temporal condition, but for beginning i'm trying to just set an array of values in the initial condition of my function. My equation looks like "(alpha)*dV/dt = (beta)*d²v/d²t - v" ;
if true
function Cable_transport_HH
m = 1 ; % cylinder
nx = 20 ; %spatial discretization
nt = 100 ; % temporal discretisation
x = linspace(0,500e-6,nx);%spatial space
t = linspace(0,20e-3,nt);% time space
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);% pde solver
u = sol(:,:,1);% solution
function [c,f,s] = pdex1pde(x,t,u,DuDx)
% constant
Cm = 1 ; % Membrane Capcitance mF/cm^2
Rm = 2500e-3 ; % Ohm.cm²
Ri = 70e-3 ;% Ohm.cm
d = 5e-4 ; % diameter cm
alpha = pi*d*Cm ;
beta = (pi*d^2)/(4*Ri) ;
gamma = (pi*d/Rm) ;
c = alpha;
f = beta*DuDx;
s = gamma*u;
function u0 = pdex1ic(x)
u0 = IT IS here that i should add my array of value for V(0,t)?? ;
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = 1; %%here i set arbitrary but my cable on the right is open and i haven't found how to set this
ql = 1;
pr = 1;
qr = 1;
end
Is someone could help me to understand the PDE for solving this equation. Thanks in advance, Best regards, Antoine
9 Comments
Torsten
on 27 Apr 2017
Since you have an ordinary differential equation
tau*dv/dt = -v + n(w-v)/Rf
to define the boundary value for v at x=0, you can't use PDEPE.
You will have to discretize the expression d^2v/dx^2 in space and solve the resulting system of ordinary differential equations for v in the grid points in x-direction together with the five ODEs stated for v,w,m,h,n using ODE15S.
Look up "method-of-lines" for more details.
Best wishes
Torsten.
Answers (0)
See Also
Categories
Find more on PDE Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!