Quote:
Originally Posted by Alan Anderson
I have no idea what you're trying to say here.
|
Here is pseudo simulation code that I would write to illustrate the error amplification
Code:
Param:
T = edge oscillation period
A = edge oscillation amplitude
dt = T/20, sample rate small enough to measure oscillation
variables:
t = time,
x = encoder input
y = encoder output
x_dot = encoder input rate
y_dot= encoder output rate
Run Simulation:
while(t < runtime){
Encoder input movement:
x = A*sin(2*pi*t/T); Small oscillation movement , A < 1 to be on same edge.
x_dot = A*2*pi/T*cos(2*pi*t/T)
Encoder output change when x is centered on a threshold:
If(x > 0 ) {y = .5 } //sample
else {y = -.5 }
y_dot = (y-y_last)/dt //Derive simple rate
y_last = y;
t= t + dt;
}
Expected Results:
The output amplitude will oscillate between -.5 and .5
The amplitude ratio y/x = .5/A.
peak |y_dot| = 1/dt,
average |y_dot| = 2/dt/(20)= 2/T Average over oscillation period
Then (avg |y_dot|)/(x_dot amplitude) = 1/(A*pi)
(this is slightly less than my .5/A approximation.)