1
$\begingroup$
E1 = Sqrt[1 + (del0)^2];
del0 = 1.5;
del1 = 1.5;
a = 1.5
a1 = 1.5
sol = NDSolve[{D[A[x, y, t], t] == 
    E1 - (1 + I*del0)*A[x, y, t] - (Abs[B[x, y, t]])^2 + 
     I*a*Laplacian[A[x, y, t], {x, y}], 
   D[B[x, y, t], t] == 
    A[x, y, t]*Conjugate[B[x, y, t]] - (1 + I*del1)*B[x, y, t] + 
     I*a1*Laplacian[B[x, y, t], {x, y}], A[x, y, 0] == 1.5, 
   B[x, y, 0] == 0.25, A[5, y, t] == A[-5, y, t], 
   A[x, 5, t] == A[x, -5, t], B[5, y, t] == B[-5, y, t], 
   B[x, 5, t] == B[x, -5, t]}, {A, B}, {x, -5, 5}, {y, -5, 5}, {t, 0, 
   10000}, Rule[MaxSteps, 1000]]

I am trying to plot this coupled nonlinear diffrential equation. This is giving a output as a interploting function, but when I try to plot it nothing I see nothing.

$\endgroup$

closed as off-topic by Szabolcs, MarcoB, m_goldberg, gwr, happy fish Mar 3 '17 at 5:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, MarcoB, m_goldberg, gwr, happy fish
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ this plots something. Plot3D[Re[A[x, y, 4*^-7]] /. First@sol, {x, -5, 5}, {y, -5, 5}] Note the solver stopped at t~4.3 10^-7,and the results are complex. $\endgroup$ – george2079 Mar 2 '17 at 17:26
  • $\begingroup$ Thank You @george2079. I am struggling in this program to get some solution. $\endgroup$ – Varun sharma Mar 2 '17 at 18:57
2
$\begingroup$

To examine the solutions, we will first extract it from NDSolve (we can do it directly but i prefer this way),

{Asol, Bsol} = sol[[1, All, 2]];

Now, we will assign some random values to the independent variables,

Asol /. t -> 0 /. x -> 1 /. y -> 2

1.5 + 0. I

Bsol /. t -> 0 /. x -> 1 /. y -> 2

0.25 + 0. I

which clearly shows that the solutions are complex as suggested by @george2079. The routine way of plotting will not work here, i.e.,

Plot3D[{Asol /. t -> 1, Bsol /. t -> 1}, {x, -5, 5}, {y, -5, 5}]

It will generate empty plot unless, we guide Plot3D to understand the nature of the solution.

To do this, we need to specify real and imaginary, using Re and Im, respectively.

Plot3D

Plot3D[{Re[Asol /. t -> 1], Re[Bsol /. t -> 1]}, {x, -5, 5}, {y, -5, 5}]

enter image description here

Plot3D[{Im[Asol /. t -> 0], Re[Bsol /. t -> 0]}, {x, -5, 5}, {y, -5, 5}]

enter image description here

Plot

You can also plot 2D,

Plot[{Re[Asol /. t -> 100 /. x -> 5], Re[Bsol /. t -> 100 /. x -> 5]}, {y, -5, 5},
 Frame -> True]

enter image description here

Edit

The Abs[A] can be plotted like this,

Plot3D[Abs[Asol /. t -> 1], {x, -5, 5}, {y, -5, 5}]

You can animate the solution with time like this,

Ain = Table[Plot3D[Abs[Asol], {x, -5, 5}, {y, -5, 5}, PlotPoints -> 40, 
    ImageSize -> 400, PlotLabel -> Style["t = " <> ToString[t], Bold, 18], 
    ImagePadding -> 30], {t, 0, 4, 0.1}];
Export["C:/tcdata/test.gif", Ain, "DisplayDurations" -> 1, 
         AnimationRepetitions" -> Infinity]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you for your suggestion. I would like to discuss something extra on this, if it is comfortable can you give me your email ID. $\endgroup$ – Varun sharma Mar 2 '17 at 18:56
  • $\begingroup$ This one is giving an empty plot.. Also If i want to integrate over some time period then should i increase the range of t $\endgroup$ – Varun sharma Mar 3 '17 at 5:07
  • $\begingroup$ @Varunsharma Which one is giving you empty plot? $\endgroup$ – zhk Mar 3 '17 at 5:12
  • $\begingroup$ If I am trying to plot3d $\endgroup$ – Varun sharma Mar 3 '17 at 5:14
  • $\begingroup$ journals.aps.org/pre/abstract/10.1103/PhysRevE.65.036610 can you please check this link. $\endgroup$ – Varun sharma Mar 3 '17 at 5:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.