Perform discrete-time integration or accumulation of signalexpand
https://www.mathworks.com/help/simulink/slref/discretetimeintegrator.html
gainK=1
(1)x(n+1)=x(n)+K∗T∗u(n)(2)y(n)=x(n)
find the y(n)
y(n+1)=x(n+1)from (2)y(n+1)=x(n)+K∗T∗u(n+1)from (1)y(n+1)=y(n)+K∗T∗u(n+1)substitute x(n) from (2)y(n)=y(n−1)+K∗T∗u(n)make u(n) is now
tag_angle_integral = tag_angle_integral + tag_angle * update_rate_;
(3)x(n)=y(n−1)+K∗T/2∗u(n−1)(4)y(n)=x(n)+K∗T/2∗u(n)
find y(n)
y(n)=y(n−1)+K∗T/2∗u(n−1)+K∗T/2∗u(n)substitute (4) into x(n)
tag_angle_integral = tag_angle_integral + last_tag_angle * 0.5 * update_rate_ + tag_angle * 0.5 * update_rate_;
反正微分都會多浪費一個記憶體了,就用Trapezoidal Method 吧
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up