# The perturbed sine-Gordon equation.

1. Mar 27, 2006

### sigmund

Well, maybe this is not a mathematics question after all, but however, I ask it here.

I have to implement a semi-difference scheme in Matlab of the perturbed sine-Gordon equation

$$u_{1,t}=u_2$$
$$u_{2,t}=u_{1,xx}-\sin(u_1)-\alpha u_2+\gamma.$$

Here $u_1$ and $u_2$ are functions of $x$ and $t$, and $\alpha$ and $\gamma$ are constants. Solutions are searched in the interval $0\leq x\leq\ell$ and for $t\geq0$.

Discretization gives

$$u_{1i,t}=u_{2i}$$
$$u_{2i,t}=\frac{1}{(\Delta x)^2}(u_{1(i-1)}-2u_{1i}+u_{1(i+1)})-\sin(u_{1i})-\alpha u_{2i}+\gamma$$

for $i=2,3,\dots,N-1$.
For $i=1$ and $i=N$ we get

$$u_{11,t}=u_{21}$$
$$u_{21,t}=\frac{1}{(\Delta x)^2}(2u_{12}-2u_{11}-2\eta\Delta x)-\sin(u_{11})-\alpha u_{21}+\gamma$$

and

$$u_{1N,t}=u_{2N}$$
$$u_{2N,t}=\frac{1}{(\Delta x)^2}(2u_{1(N-1)}-2u_{1N}+2\eta\Delta x)-\sin(u_{1N})-\alpha u_{2N}+\gamma$$

respectively.
Here, the constant $\eta$ comes from the two boundary conditions $u_x(0,t)=\eta$ and $u_x(\ell,t)=\eta$.

I have implemented this into Matlab. The implementation is seen in the attached files sineG.m and sineGsol.m. I believe my implementation is correct, but I do not get the correct solution.

I would like to receive some comments on the implementation. Do you see any errors? It might be that I am plotting the wrong values against each other.

#### Attached Files:

File size:
234 bytes
Views:
81
• ###### sineGsol.m
File size:
879 bytes
Views:
85
Last edited: Mar 27, 2006
2. Mar 30, 2006

### sigmund

Well, after all, everything is correct. It just occurred to me that I did not plot the correct arrays against each other. I've corrected that, and now I have got the correct solutions.