0
$\begingroup$

I'm testing out code from a textbook for possible bugs. This chapter demonstrates a plot of a motor's angular position response in accordance to it's transfer function model:

L = 0.01; R = 6.; \[Zeta] = 0.005; Subscript[k, m] = 0.09; J = 0.02; \
Subscript[k, g] = 18; tend = 1.5;
sysnf = TransferFunctionModel[
   Subscript[k, 
    g]/(s ((R + L s) (J s + \[Zeta]) + 
        Subscript[k, g] Subscript[k, m])), s];
tfbk = SystemsModelFeedbackConnect[
   sysnf[R, L, Subscript[k, g], Subscript[k, m] J, \[Zeta]], 1];
tfbk = SystemsModelFeedbackConnect[
   sysnf[R, L, Subscript[k, g], Subscript[k, m] J, \[Zeta]]];
sys1out = OutputResponse[tfbk, UnitStep[t], {t, 0, tend}];
Plot[sys1out, {t, 0, tend}, PlotRange -> All, 
 AxesLabel -> {"\[Tau]", "\[Theta](\[Tau])"}]

I know the issue lies in the SystemsModelFeedbackConnect[] function but I'm still having trouble trying to make the plot to look like the following: enter image description here

$\endgroup$
1
$\begingroup$

Haha nvm, I found out the argument syntax by accident:

L = 0.01; R = 6.; \[Zeta] = 0.005; Subscript[k, m] = 0.09; J = 0.02; \
Subscript[k, g] = 18; tend = 1.5;
sysnf = TransferFunctionModel[
   Subscript[k, 
    g]/(s ((R + L s) (J s + \[Zeta]) + 
        Subscript[k, g] Subscript[k, m])), s];
tfbk = SystemsModelFeedbackConnect[sysnf];
sys1out = OutputResponse[tfbk, UnitStep[t], {t, 0, tend}];
Plot[sys1out, {t, 0, tend}, PlotRange -> All, 
 AxesLabel -> {"\[Tau]", "\[Theta](\[Tau])"}]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.