# 反馈线性化

 In[1]:= Xpars = {R -> 10, L -> 0.05, m -> 0.05, g -> 9.8, c -> 0.05, Subscript[x, 0] -> 0.1};
 In[2]:= Xassm = AffineStateSpaceModel[{m x''[t] == m g - c (i[t]/x[t])^2, R i[t] + L i'[t] == V[t]}, {{x[t], Subscript[x, 0]}, {x'[t], 0}, {i[t], Subscript[x, 0] Sqrt[(m g)/c]}}, {{V[t], R Subscript[x, 0] Sqrt[(m g)/c]}}, x[t], t] /. pars
 Out[2]=

 In[3]:= X\[ScriptCapitalF] = FeedbackLinearize[ assm, {{Subscript[z, 1], Subscript[z, 2], Subscript[z, 3]}, v}];
 In[4]:= X\[ScriptCapitalF]["ResidualSystem"]
 Out[4]=

 In[5]:= X\[Kappa]1 = StateFeedbackGains[\[ScriptCapitalF][ "LinearSystem"], {-1.5, -2 + I, -2 - I}]
 Out[5]=

 In[6]:= Xcsys1 = \[ScriptCapitalF][{"ClosedLoopSystem", \[Kappa]1}]; ics = {0.3, 0, 0.31305};
 In[7]:= Xcsys1 = \[ScriptCapitalF][{"ClosedLoopSystem", \[Kappa]1}]; ics = {0.3, 0, 0.31305};; or1 = OutputResponse[{csys1, ics}, 0, {t, 0, 35}]; Plot[%, {t, 0, 6}]
 Out[7]=

 In[8]:= X\[Kappa]2 = StateFeedbackGains[assm, {-1.5, -2 + I, -2 - I}]
 Out[8]=

 In[9]:= Xcsys2 = SystemsModelStateFeedbackConnect[assm, \[Kappa]2]; or2 = OutputResponse[{csys2, ics}, 0, {t, 0, 35}];
 In[10]:= XPlot[{or1, or2}, {t, 0, 35}, PlotLegends -> {"Exact", "Approximate"}]
 Out[10]=

 In[11]:= Xc1 = \[ScriptCapitalF][{"OriginalSystemFullController", \[Kappa]1}]
 Out[11]=

 In[12]:= Xinps1 = Join[{0}, sr1 = StateResponse[{csys1, ics}, 0, {t, 0, 35}]]; ce1 = OutputResponse[c1, inps1, {t, 0, 35}];
 In[13]:= XPlot[ce1, {t, 0, 35}, PlotRange -> All]
 Out[13]=

 In[14]:= Xce2 = -\[Kappa]2 /. Thread[{Subscript[\[FormalX], 1][t], Subscript[\[FormalX], 2][t], Subscript[\[FormalX], 3][t]} -> StateResponse[{csys2, ics}, 0, {t, 0, 35}]];
 In[15]:= XPlot[{ce1, ce2}, {t, 0, 35}, PlotLegends -> {"Exact", "Approximate"}]
 Out[15]=

 播放动画停止播放动画

## Mathematica

Questions? Comments? Contact a Wolfram expert »