0
$\begingroup$

I have the following code

ω1 = 2 π*2*10^9;
ω2 = 2 π*4*10^9;
ω3 = 2 π*3*10^9;
ω4 = ω1 + ω2 - ω3;
Cj = 329*10^-15;
LL = 100*10^-12;
a = 10*10^-6;
I0 = 3.29*10^-6;
CC0 = 39*10^-15;

k1 = (Sqrt[CC0 LL] *(ω1))/(a Sqrt[1 - Cj LL *(ω1)^2]);
k2 = (Sqrt[CC0 LL] *(ω2))/(a Sqrt[1 - Cj LL *(ω2)^2]);
k3 = (Sqrt[CC0 LL] *(ω3))/(a Sqrt[1 - Cj LL *(ω3)^2]);
k4 = (Sqrt[CC0 LL] *(ω4))/(a Sqrt[1 - Cj LL *(ω4)^2]);
o1 = (a^4*k1*k2*k3*k4)/(8*CC0*I0^2*LL^3);
o2 = a^4/(16*CC0*I0^2*LL^3);
Ω1 = Expand[k3 + k4 - k2]/ω1^2; 
Ω2 = Expand[k3 + k4 - k1]/ω2^2;
Ω3 = Expand[k1 + k2 - k4]/ω3^2;
Ω4 = Expand[k1 + k2 - k3]/ω4^2;
λ11 = Expand[k1^5]/ω1^2; 
λ21 = Expand[k2^3*k1^2*2]/ω2^2;
λ31 = Expand[k3^3*k1^2*2]/ω3^2;
λ41 = Expand[k4^3*k1^2*2]/ω4^2;
λ12 = Expand[k1^3*k2^2*2]/ω1^2;
λ22 = Expand[k2^5]/ω2^2;
λ32 = Expand[k3^3*k2^2*2]/ω3^2;
λ42 = Expand[k4^3*k2^2*2]/ω4^2;
λ13 = Expand[k1^3*k3^2*2]/ω1^2;
λ23 = Expand[k2^3*k3^2*2]/ω2^2;
λ33 = Expand[k3^5]/ω3^2;
λ43 = Expand[k4^3*k3^2*2]/ω4^2;
λ14 = Expand[k1^3*k4^2*2]/ω1^2;
λ24 = Expand[k2^3*k4^2*2]/ω2^2;
λ34 = Expand[k3^3*k4^2*2]/ω3^2;
λ44 = Expand[k4^5]/ω4^2;
QQ1 = o2/o1*(1/Sqrt[Ω1*Ω2*Ω3*Ω4])*(λ11 + λ21 - λ31 - λ41)*Ω1; 
QQ2 = o2/o1*(1/Sqrt[Ω1*Ω2*Ω3*Ω4])*(λ12 + λ22 - λ32 - λ42)*Ω2;
QQ3 = o2/o1*(1/Sqrt[Ω1*Ω2*Ω3*Ω4])*(λ13 + λ23 - λ33 - λ43)*Ω3;
QQ4 = o2/o1*(1/Sqrt[Ω1*Ω2*Ω3*Ω4])*(λ14 + λ24 - λ34 - λ44)*Ω4;
C0 = Sqrt[1 - 1/16*(QQ1 + QQ2 - QQ3 - QQ4)^2] ;
Δkl = k1 + k2 - k3 - k4;
PP10 = (0.5*I0*50)^2;
PP40 = j*2 PP10;
PP = 2 PP10 + PP40; 
Δs = Δkl/(o1*PP*Sqrt[Ω1*Ω2*Ω3*Ω4]);
x1 = PP10/(Ω1*PP) + PP40/(Ω1*PP);
x2 = PP10/(Ω2*PP) + PP40/(Ω4*PP);
x3 = -(PP40/(Ω4*PP));
CCC = -(Δs/2)*(PP40/(Ω4*PP)) + 1/4*((PP10/PP)^2*(QQ1/Ω1^2 + QQ2/Ω2^2) - (PP40/PP)^2*QQ4/Ω4^2);

ff = Expand[x*(x1 - x)*(x2 - x)*(x3 + x) - (CCC + Δs/2*x - QQ1/4*(x1 - x)^2 - QQ2/4*(x2 - x)^2 + QQ3/4*(x3 + x)^2 + QQ4/4*x^2)^2];
rootsη = Expand[x /. Solve[ff == 0, x]];

loopedroots = Table[{j, rootsη}, {j, 0.01, 1, 0.01}];
sortedloopedroots = Table[{loopedroots[[i]][[1]], Sort[loopedroots[[i]][[2]], Greater]}, {i, 1, Length[loopedroots]}];
loopedη = Table[{sortedloopedroots[[i]][[1]], (sortedloopedroots[[i]][[2]][[2]] - sortedloopedroots[[i]][[2]][[3]])/(sortedloopedroots[[i]][[2]][[2]] - sortedloopedroots[[i]][[2]][[4]])}, {i, 1, Length[sortedloopedroots]}];
loopedmodulusk = Table[{sortedloopedroots[[i]][[1]], √(((sortedloopedroots[[i]][[2]][[2]] - sortedloopedroots[[i]][[2]][[3]])*(sortedloopedroots[[i]][[2]][[1]] - sortedloopedroots[[i]][[2]][[4]]))/((sortedloopedroots[[i]][[2]][[2]] - sortedloopedroots[[i]][[2]][[4]])*(sortedloopedroots[[i]][[2]][[1]] - sortedloopedroots[[i]][[2]][[3]])))}, {i, 1, Length[sortedloopedroots]}];
loopedzc = Table[{sortedloopedroots[[i]][[1]], 1/(o1*(PP /. {j -> sortedloopedroots[[i]][[1]]})* Abs[C0]*√((sortedloopedroots[[i]][[2]][[2]] - sortedloopedroots[[i]][[2]][[4]])*(sortedloopedroots[[i]][[2]][[1]] - sortedloopedroots[[i]][[2]][[3]])*Ω1*Ω2*Ω3*Ω4))}, {i, 1, Length[sortedloopedroots]}];
loopedellipticϕ = Table[{sortedloopedroots[[i]][[1]], ArcSin[√(((PP40 - Ω4*PP* sortedloopedroots[[i]][[2]][[3]])/(loopedη[[i]][[2]]*(PP40 - Ω4*PP*sortedloopedroots[[i]][[2]][[4]]))) /. {j -> sortedloopedroots[[i]][[1]]})]}, {i, 1,Length[sortedloopedroots]}];

loopedsiggain1 = Table[{sortedloopedroots[[i]][[1]], (Ω4*PP)/PP40*((sortedloopedroots[[i]][[2]][[3]] - loopedη[[i]][[2]]*sortedloopedroots[[i]][[2]][[4]]*(JacobiSN[(1150*a)/loopedzc[[i]][[2]] + EllipticF[loopedellipticϕ[[i]][[2]], (loopedmodulusk[[i]][[2]])^2], (loopedmodulusk[[i]][[2]])^2])^2)/(1 - loopedη[[i]][[2]]*(JacobiSN[(1150*a)/loopedzc[[i]][[2]] + EllipticF[loopedellipticϕ[[i]][[2]], (loopedmodulusk[[i]][[2]])^2], (loopedmodulusk[[i]][[2]])^2])^2)) /. {j -> sortedloopedroots[[i]][[1]]}}, {i, 1, Length[sortedloopedroots]}];

ListLogLinearPlot[Abs[loopedsiggain1], PlotRange -> Full, Joined -> True]

which generates a plot that looks like the following enter image description here

However, if I place the function ff and rootsη at the very top of the code (before ω1 = 2 π*2*10^9;) my ListLogLinearPlot gives

enter image description here

Why is this happening? There also shouldn't be any strong oscillatory behavior. I'd appreciate any help i can get. Thank you.

$\endgroup$

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.