sigmund
- 23
- 0
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
<br /> u_{1,t}=u_2<br />
<br /> u_{2,t}=u_{1,xx}-\sin(u_1)-\alpha u_2+\gamma.<br />
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
<br /> u_{1i,t}=u_{2i}<br />
<br /> 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<br />
for i=2,3,\dots,N-1.
For i=1 and i=N we get
<br /> u_{11,t}=u_{21}<br />
<br /> u_{21,t}=\frac{1}{(\Delta x)^2}(2u_{12}-2u_{11}-2\eta\Delta x)-\sin(u_{11})-\alpha u_{21}+\gamma<br />
and
<br /> u_{1N,t}=u_{2N}<br />
<br /> 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<br />
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.
I have to implement a semi-difference scheme in Matlab of the perturbed sine-Gordon equation
<br /> u_{1,t}=u_2<br />
<br /> u_{2,t}=u_{1,xx}-\sin(u_1)-\alpha u_2+\gamma.<br />
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
<br /> u_{1i,t}=u_{2i}<br />
<br /> 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<br />
for i=2,3,\dots,N-1.
For i=1 and i=N we get
<br /> u_{11,t}=u_{21}<br />
<br /> u_{21,t}=\frac{1}{(\Delta x)^2}(2u_{12}-2u_{11}-2\eta\Delta x)-\sin(u_{11})-\alpha u_{21}+\gamma<br />
and
<br /> u_{1N,t}=u_{2N}<br />
<br /> 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<br />
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.
Attachments
Last edited: