« View all new features in
Mathematica
9
◄
previous

next
►
New in
Mathematica
9
›
Enhanced Control Systems
ClosedLoop Responses with a PID Controller
Plot the output and control responses for different exogenous inputs.
In[1]:=
X
pid = PIDTune[ TransferFunctionModel[ Unevaluated[{{1/((0.4 s + 1) (0.5 s + 1)^2)}}], s, SamplingPeriod >None, SystemsModelLabels > None], "PID", "PIDData"];
The output and and control responses for a
SquareWave
process disturbance.
In[2]:=
X
d = SquareWave[t]; yres1 = OutputResponse[pid["DisturbanceOutput"], d, {t, 0, 5}]; ures1 = OutputResponse[pid["DisturbanceControl"], d, {t, 0, 5}];
In[3]:=
X
{Plot[yres1, {t, 0, 5}, PlotRange > All], Plot[ures1, {t, 0, 5}, PlotRange > All]}
Out[3]=
The output and control responses for a
UnitBox
reference.
In[4]:=
X
r = UnitBox[t]; yres2 = OutputResponse[pid["ReferenceOutput"], r, {t, 0, 5}]; ures2 = OutputResponse[pid["ReferenceControl"], r, {t, 0, 5}];
In[5]:=
X
{Plot[yres2, {t, 0, 5}, PlotRange > All], Plot[ures2, {t, 0, 5}, PlotRange > All]}
Out[5]=
The output and control responses for a ramp sensor noise.
In[6]:=
X
m = 0.2 t; yres3 = OutputResponse[pid["SensorOutput"], m, {t, 0, 5}]; ures3 = OutputResponse[pid["SensorControl"], m, {t, 0, 5}];
In[7]:=
X
{Plot[yres3, {t, 0, 5}, PlotRange > All], Plot[ures3, {t, 0, 5}, PlotRange > All]}
Out[7]=