First, obtain the closed-loop function of the system from the open-loop function, and expand this function into a Taylor series with respect to the variable s. The constant coefficients c0, c1, c2, etc., in the series are the dynamic error coefficients. Typically, c0 is referred to as the dynamic position error coefficient, c1 as the dynamic velocity error coefficient, and c2 as the dynamic acceleration error coefficient.
clear; syms s1 G1 H1 BH1 BH2; syms w1 t1 r1 r2 err1; format short; G1=5/((s1+1)*(s1+2)); H1=2*s1; BH1=1/(1+G1*H1); s1=sym(s1); BH2=taylor(BH1,s1,0); r1=sin(w1*t1); r2=diff(r1,’t1′,1); r3=diff(r1,’t1′,2); r4=diff(r1,’t1′,3); r5=diff(r1,’t1′,4); r6=diff(r1,’t1′,5); c0=1; c1=-5; c2=65/2; c3=-835/4; c4=10725/8; c5=-137755/16; err1=vpa(c0*r1+c1*r2+c2*r3+c3*r4+c4*r5+c5*r6,6); err2=collect(collect(err1,cos(w1*t1)),sin(w1*t1));