I am trying to solve two coupled equations. I have one parameter, namely c, in the program given below. What I am trying to find is the solution for the coupled differential equation and once I have it I would like to plot the absolute value of Ar2/Ar1 as a function of my parameter c. Below is my code. For some reason, the program doesn't plot what I expect. Can anyone tell me what mistake I made?

a = 1.11577*10^10;
b = -2.11923*10^7;
n = 11167.3;
Subscript[L, i] = 0.4814*10^-3;
Subscript[z, 1] = 0.25*10^-3;
Subscript[z, 2] = 1.75*10^-3;
a1 = 1;
q[z_] := a*z^2 + b*z + n;
y = 1;

g = π/Subscript[L, i];
κ[z_] := c*(g - q[z]);
syst = ParametricNDSolve[{Ar1'[z] == 
    I*c*(g - q[z])*Ar2[z]*Exp[-I*q[z]*z], 
   Ar2'[z] == I*c*(g - q[z])*Ar1[z]*Exp[+I*q[z]*z], 
   Ar1[Subscript[z, 1]] == y, Ar2[Subscript[z, 2]] == 0}, {Ar1, 
   Ar2}, {z, Subscript[z, 1], Subscript[z, 2]}, {c}]

 Evaluate@Table[{Abs[Ar2[c][z]/Ar1[c][z]]^2} /. syst, {c, 0.1, 
    1, .1}], {z, Subscript[z, 1], Subscript[z, 2]}, AspectRatio -> 1]
  • $\begingroup$ If you wrap Re[...] around the outside of your Evaluate[...] then you may see curves plotted instead of a blank plot. That is perhaps a hint that one or more points of your plot might have complex values and that is causing plot to not display anything. $\endgroup$ – Bill Aug 31 at 2:48
  • $\begingroup$ Use Plot, not ParametricPlot. $\endgroup$ – bbgodfrey Aug 31 at 4:28
  • $\begingroup$ @Bill Thanks for your comment. I figured it out $\endgroup$ – raj rajagopal Sep 2 at 23:07
  • $\begingroup$ @bbgodfrey Thanks for your comment. I used Plot and it works now. $\endgroup$ – raj rajagopal Sep 2 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.