How to insert initial condition
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 26 Apr 2017
I don't see an x-variable in your equation - so why do you use "pdepe" instead of "bvp4c"?
Is "v" = "V" in your equation ?
Does d²v/d²t mean d²v/dt² ?
What are your boundary conditions ?
Best wishes
Torsten.
antoine jury
on 26 Apr 2017
antoine jury
on 26 Apr 2017
Edited: antoine jury
on 26 Apr 2017
Torsten
on 27 Apr 2017
I don't know your boundary conditions, but maybe already ODE45 suffices to solve your problem.
Best wishes
Torsten.
antoine jury
on 27 Apr 2017
Torsten
on 27 Apr 2017
You need two boundary conditions to solve your problem.
If both of them are given either at t=0 or at t=L, you can use ODE45.
If one condition is given at t=0 and the other at t=L, you will have to use bvp4c.
Best wishes
Torsten.
antoine jury
on 27 Apr 2017
Edited: antoine jury
on 27 Apr 2017
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.
antoine jury
on 27 Apr 2017
Answers (0)
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!