TITLE: Numerical Solutions of the Telegrapher's Equation
QUESTION [5 upvotes]: I'm currently working on a brief report on the Telegrapher's Equation for my fractional calculus course. I am still new to Telegrapher's Equations, but I do know they are used to describe electrical signs traveling along a transmission cable (whether it's a coaxial cable, a microstrip, etc). 
Anywho, to make a long story short, I derived the Telegrapher's Equation upon analyzing the elementary components of a transmission line:
\begin{eqnarray}
\frac{\partial^2 v}{\partial t^2} + \frac{(LG+RC)}{LC}\frac{\partial v}{\partial t} + \frac{RG}{LC}v & = &  \frac{1}{LC}\frac{\partial^2 v}{\partial x^2} 
\end{eqnarray}
Where $v(x,t) = v$ is the voltage across the piece of wire, $R$ is the resistance, $L$ is the inductance, $G$ is the conductance, and $C$ is the capacitance. For simplicity, I will define $c= 1/\sqrt{LC}$, $a = c^2(LG+RC)$ and $b = c^2RG$,then we get: 
\begin{eqnarray}
  \frac{\partial^2 v}{\partial t^2} + a\frac{\partial v}{\partial t} + bv  & = &c^2\frac{\partial^2 v}{\partial x^2}
\end{eqnarray}  
This is where my question comes in, I'm still new to solving PDEs numerically, let alone solving a fractional PDEs. 
Could someone help me better understand how to solve this problem numerically (not taking into consideration the fractional derivatives for now)? I assume we need boundary conditions. Sadly, I wouldn't know what the boundary conditions of a Telegrapher's Equation would be. I guess to keep things easier, we can assume we are dealing with a lossless system, therefore $R=G =0$. Thus our PDE simplifies greatly to:
\begin{eqnarray}
  \frac{\partial^2 v}{\partial t^2} & = &c^2\frac{\partial^2 v}{\partial x^2}
\end{eqnarray} 
which we can use to consider the following approximation:
\begin{eqnarray}
\frac{v(x,t+\Delta t)-2v(x,t)+v(x,t-\Delta t)}{\Delta x}& = & c^2\frac{v(x+\Delta x,t)-2v(x,t)+v(x-\Delta x,t)}{\Delta x}
\end{eqnarray}
Then solving for the future time we get:
\begin{eqnarray}
v(x,t+\Delta t)& = & r^2[v(x+\Delta x,t)+v(x-\Delta x,t)] + 2(1-r^2)v(x,t)-v(x,t-\Delta t)
\end{eqnarray}
Now I have some rough idea of how to set up the solution in MATLAB, but since I'm still new to MATLAB and I don't have an idea for what a boundary condition of a telegrapher's equation could be (since that is not my field of study), I am terribly stuck and have not seem to make much progress like I would have like.

Anywho, I really thank you for all the time you have taken to read this post. I also thank you in advance for your contribution, help, feedback, and more.
Have a wonderful day.

REPLY [2 votes]: I can't help with the fractional derivatives, but I can with the "normal" PDE. What I usually try to do is use Matlab's ODE tools to take care of the time stepping, and only discretise the spatial derivatives. So, using $v_i(t)$ to denote the solution at the $i$-th spatial grid point, you get equations like this:
$$ \frac{\partial^2v_i}{\partial t^2}+a\frac{\partial v_i}{\partial t}+bv_i=\frac{c^2}{\Delta x^2}\left(v_{i-1}-2v_i+v_{i+1}\right). $$
Obviously you could use a different stencil if you want. You also have to think about the boundary conditions, I'll assume they are $v_0=\alpha$ and $v_N=\beta$.
This gives you a matrix system of differential equations. Forgetting the left hand side for a moment, notice that we can write the right hand side as a matrix multiplication,
$$\frac{c^2}{\Delta x^2}\begin{bmatrix}\alpha & 0 & 0 & 0 & \ldots & 0 \\ 1 & -2 & 1 & 0 & \ldots & 0 \\ 0 & 1 & -2 & 1 & \ldots & 0 \\ 0 & 0 & 0 & 0 & \ldots & \beta\end{bmatrix}\begin{bmatrix}v_0\\v_1\\ \vdots\\v_N\end{bmatrix},$$
and I will call the differentiation matrix $M$ from now on.
Now you have to write this as a system of first-order ODEs, which is simple enough. Let $u_{i,1}=v_i$ and $u_{i,2}=v'_i$, then $u'_{i,1}=u_{i,2}$ and 
$$ u'_{i,2}=\frac{c^2}{\Delta x^2}(M\vec u)_i-au_{i,2}-bu_{i,1}.$$
Writing these as vector equations is neater,
$$\vec u'_1=\vec u_2$$
and
$$ \vec u'_2=\frac{c^2}{\Delta x^2}M\vec u_1-au_2-bu_1.$$
You can solve these using ode45 in Matlab, with initial conditions that you will have to work out. It's not trivial, but here is the code that solves $$\frac{\partial^2v}{\partial t^2}+a\frac{\partial v}{\partial t}+bv=c\frac{\partial^2v}{\partial x^2}. $$
a=1;b=1;c=1; %// coefficients of PDE
dx=0.05; %// spatial grid spacing
x=(0:dx:1).'; %// spatial grid
N=length(x); 
%// differentiation matrix, using centred differencing at interior points
M=diag(ones(1,N-1),-1)+diag(-2*ones(1,N))+diag(ones(1,N-1),1);
M(1,1:3)=[1 -2 1]; %// and forward/backward differencing at boundaries
M(end,(N-2):N)=[1 -2 1];

%// Our u vector is [u1;u2], so the derivative has to be [u2;M*u1-u2-u1]
%// plus correction for boundary conditions
dudt=@(t,u)[[-c*sin(c*t);u(N+2:end-1);-c*sin(1+c*t)];
    c^2*M*u(1:N)/(dx^2)-a*u(N+1:end)-b*u(1:N)];

options=odeset('MaxStep',dx); %// some kind of CFL condition, I didn't work
                              %// it out properly, but this works so it's OK!

[t,u]=ode45(dudt,[0 15],[cos(x);-c*sin(x)],options); %// time-stepping using ode45
                        %// the initial condition is [v;dv/dt] at t=0


for i=1:length(t) %// To see the results
    plot(x,u(i,1:N))
    axis([0 1 -1 1])
    drawnow
    pause(0.01)
end

If you set $a=b=0$ then you can compare the numerical solution to the exact solution $\cos(x+ct)$.
I hope that helps!