2
저는 TwoAxisPlot을 사용하여 NDSolve의 함수에 대해 두 개의 플롯을 결합했지만 그 결과는 커브 중 하나가 잘리고 따라서 불완전합니다. TwoAxisPlot 함수를 정의 할 때 모든 전문 용어를 이해할 수 없으므로 문제의 원인을 알 수 없습니다. 코드는 다음과 같다 :2 축 플롯, 커브 중 하나가 불완전합니다
a = 0.99*10^-9;
b = 0.24*10^-3;
d = 1.21*10^-3;
T0 = 1*10^6;
n0 = 0.9*10^9;
ti = -20;
tf = 500;
kB = 1.38*10^-16;
Qb = 0.33*10^-3;
sig = 1;
var = sig^2;
Ag = 16.5;
Qg = Ag* Exp[-(t - 10)^2/(2*var)];
Qgt = Qg + Qb;
sss = NDSolve[{T'[t] == -(n[t]^-1) T[t]^(7/2) (a) -
n[t] T[t]^(-1/2) (b) + Qgt/(2*kB*n[t]),
n'[t] == T[t]^(5/2) (a) - (n[t]^2) (T[t]^(-3/2)) (d), T[ti] == T0,
n[ti] == n0}, {T, n}, {t, ti, tf}];
이 나에게주는 내가 완전히 개별적으로 그릴 수있는 두 개의 보간 기능 :
TP = Plot[T[t] /. sss, {t, ti, 300}, PlotRange -> All];
TPPa = Show[TP, Frame -> True,
FrameLabel -> {{"Temperature, K", ""}, {"Time, s", ""}}]
NP = Plot[n[t] /. sss, {t, ti, 300}, PlotRange -> All];
NPPa = Show[NP, Frame -> True,
FrameLabel -> {{"Density, \!\(\*SuperscriptBox[\(cm\), \(-3\)]\)",
""}, {"Time, s", ""}}]
내가 다음 TwoAxisPlot 함수를 정의, 변경, 복사 이 웹 사이트 : Wolfram Documentation Center
TwoAxisPlot[{f_, g_}, {x_, x1_, x2_}] :=
Module[{fgraph, ggraph, frange, grange, fticks,
gticks}, {fgraph, ggraph} =
MapIndexed[
Plot[#, {x, x1, x2}, Axes -> True,
PlotStyle -> ColorData[1][#2[[1]]]] &, {f, g}]; {frange,
grange} = (PlotRange /. AbsoluteOptions[#, PlotRange])[[
2]] & /@ {fgraph, ggraph}; fticks = [email protected][frange, 5];
gticks =
[email protected]@{fticks,
ToString[NumberForm[#, 2], StandardForm] & /@
Rescale[fticks, frange, grange]};
Show[fgraph,
ggraph /.
Graphics[graph_, s___] :>
Graphics[
GeometricTransformation[graph,
RescalingTransform[{{0, 1}, grange}, {{0, 1}, frange}]], s],
Axes -> False, Frame -> True,
FrameStyle -> {ColorData[1] /@ {1, 2}, {Automatic, Automatic}},
FrameTicks -> {{fticks, gticks}, {Automatic, Automatic}}]]
과는
TwoAxisPlot[{T[t] /. sss, n[t] /. sss}, {t, -20, 300}]
하지만 플롯은 이제 절단하고 전체 곡선을 표시하지 않습니다 사용합니다. 이 문제를 어떻게 해결할 수 있습니까?
환상적인, 감사합니다! –