I used two dashed lines in the following codes to separate my plot into three blocks filled with color. But the fillings would obscure the curves (EtaH[n]
and EpsilonH[n]
).
fill1 = Rectangle[{zerosofeta[[1]], Log@(10^(-12))}, {zerosofeta[[2]],
Log@4}];
fill2 = Rectangle[{0, Log@(10^(-12))}, {zerosofeta[[1]], Log@4}];
fill3 = Rectangle[{zerosofeta[[2]], Log@(10^(-12))}, {70, Log@4}];
LogPlot[{\[Epsilon]H[n],Abs[\[Eta]H[n]]}, {n, 0, 70},PlotRange -> {10^(-11), 4},
Epilog -> {{Directive[Black,
Dashed],
Line[{{zerosofeta[[1]], Log@(10^(-12))}, {zerosofeta[[1]],
Log@4}}]}, {Directive[Black, Dashed],
Line[{{zerosofeta[[2]], Log@(10^(-12))}, {zerosofeta[[2]],
Log@4}}]},{LightGreen, fill1}, {LightBlue, fill2}, {LightBlue, fill3}}]
where zerosofeta
is a two-element list used to put the roots of EtaH[n]
.
I have tried another way
curve = LogPlot[{\[Epsilon]H[n],Abs[\[Eta]H[n]]}, {n, 0, 70},
PlotRange -> {10^(-11), 4}];
rectangles =
Graphics[{{LightGreen, fill1}, {LightBlue, fill2}, {LightBlue,
fill3},{Directive[Black,
Dashed],
Line[{{zerosofeta[[1]], Log@(10^(-12))}, {zerosofeta[[1]],
Log@4}}]}, {Directive[Black, Dashed],
Line[{{zerosofeta[[2]], Log@(10^(-12))}, {zerosofeta[[2]],
Log@4}}]}}];
Show[rectangles, curve]
but the axes disappear.
Do you have any idea?
updated: The functions etaH[n]
and epsilonH[n]
are composed of InterploatingFunction
which is the numerical solution of a PDE. But I might have a generic one to replace etaH[n]
for error finding
eta[n_] := Module[{e0 = 0.02, ni0 = 0.0, no0 = 33.2, s0 = 1.,
e1 = -6.3, ni1 = 33.2, no1 = 35.7, s1 = 0.5,
e2 = 0.3, ni2 = 35.7, no2 = 55, s2 = 1., ef = 3, nif = 55, nof = 65, sf = 2},
(e0/2) * (Tanh[(n - ni0)/s0] - Tanh[(n - no0)/s0]) +
(e1/2) * (Tanh[(n - ni1)/s1] - Tanh[(n - no1)/s1]) +
(e2/2) * (Tanh[(n - ni2)/s2] - Tanh[(n - no2)/s2]) +
(ef/2) * (Tanh[(n - nif)/sf] - Tanh[(n - nof)/sf])]
{εH[n], Abs[ηH[n]]}
$\endgroup$