Well, maybe this is not a mathematics question after all, but however, I ask it here.(adsbygoogle = window.adsbygoogle || []).push({});

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

[tex]

u_{1,t}=u_2

[/tex]

[tex]

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

[/tex]

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

Discretization gives

[tex]

u_{1i,t}=u_{2i}

[/tex]

[tex]

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

[/tex]

for [itex]i=2,3,\dots,N-1[/itex].

For [itex]i=1[/itex] and [itex]i=N[/itex] we get

[tex]

u_{11,t}=u_{21}

[/tex]

[tex]

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

[/tex]

and

[tex]

u_{1N,t}=u_{2N}

[/tex]

[tex]

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

[/tex]

respectively.

Here, the constant [itex]\eta[/itex] comes from the two boundary conditions [itex]u_x(0,t)=\eta[/itex] and [itex]u_x(\ell,t)=\eta[/itex].

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.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: The perturbed sine-Gordon equation.

**Physics Forums | Science Articles, Homework Help, Discussion**