想画一个图,最后在Manipulate命令这段卡住了,请各位大神赐教,代码如下
hxx[t_] := A0 Cos[\[Omega] t + \[Phi]0];
hxy[t_] := A0 Cos[\[Omega] t + \[Phi]0];; x0 = R Cos[\[Theta]]; y0 =
R Sin[\[Theta]]; \[Phi]0 = 0; (*参数*)
equs = {
D[x[t], {t, 2}] ==
1/2 D[hxx[t], {t, 2}] x0 + 1/2 D[hxy[t], {t, 2}] y0,
D[y[t], {t, 2}] ==
1/2 D[hxy[t], {t, 2}] x0 + 1/2 D[-hxx[t], {t, 2}] y0
}; (*微分方程*)
cond = {
x'[0] == 0, x[0] == x0, y'[0] == 0, y[0] == y0
}; (*初始条件*)
sol = Flatten[
DSolve[
{equs, cond},
{x[t], y[t]},
t]
] (*解微分方程*)
FullSimplify[
l = ComplexExpand[Abs[ComplexExpand[x[t] /. sol]]]^2 +
ComplexExpand[Abs[ComplexExpand[y[t] /. sol]]]^2
] (*考虑了复数情况的求模长*)
f = Normal[
FullSimplify[
Series[Sqrt[l], {A0, 0, 1}]
]
] (*展开至一阶近似*)
Manipulate[
PolarPlot[
f /. {R -> 1, A0 -> 0.1, \[Omega] -> 1}, {\[Theta], 0, 2 \[Pi]}
, PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}
],
{t, 0, 4 \[Pi]}
]
最后一段命令中的f始终没办法把定义引入进去,请问该怎么办呢?
hxx[t_] := A0 Cos[\[Omega] t + \[Phi]0];
hxy[t_] := A0 Cos[\[Omega] t + \[Phi]0];; x0 = R Cos[\[Theta]]; y0 =
R Sin[\[Theta]]; \[Phi]0 = 0; (*参数*)
equs = {
D[x[t], {t, 2}] ==
1/2 D[hxx[t], {t, 2}] x0 + 1/2 D[hxy[t], {t, 2}] y0,
D[y[t], {t, 2}] ==
1/2 D[hxy[t], {t, 2}] x0 + 1/2 D[-hxx[t], {t, 2}] y0
}; (*微分方程*)
cond = {
x'[0] == 0, x[0] == x0, y'[0] == 0, y[0] == y0
}; (*初始条件*)
sol = Flatten[
DSolve[
{equs, cond},
{x[t], y[t]},
t]
] (*解微分方程*)
FullSimplify[
l = ComplexExpand[Abs[ComplexExpand[x[t] /. sol]]]^2 +
ComplexExpand[Abs[ComplexExpand[y[t] /. sol]]]^2
] (*考虑了复数情况的求模长*)
f = Normal[
FullSimplify[
Series[Sqrt[l], {A0, 0, 1}]
]
] (*展开至一阶近似*)
Manipulate[
PolarPlot[
f /. {R -> 1, A0 -> 0.1, \[Omega] -> 1}, {\[Theta], 0, 2 \[Pi]}
, PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}
],
{t, 0, 4 \[Pi]}
]
最后一段命令中的f始终没办法把定义引入进去,请问该怎么办呢?