Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. // Return RC low-pass filter output samples, given input samples,
  2. // time interval dt, and time constant RC
  3. function lowpass(real[0..n] x, real dt, real RC)
  4. var real[0..n] y
  5. var real α := dt / (RC + dt)
  6. y[0] := x[0]
  7. for i from 1 to n
  8. y[i] := α * x[i] + (1-α) * y[i-1]
  9. return y
  10.  
  11. input: an array a of length n with array elements numbered 0 to n − 1
  12.  
  13. inc ← round(n/2)
  14. while inc > 0 do:
  15. for i = inc .. n − 1 do:
  16. temp ← a[i]
  17. j ← i
  18. while j ≥ inc and a[j − inc] > temp do:
  19. a[j] ← a[j − inc]
  20. j ← j − inc
  21. a[j] ← temp
  22. inc ← round(inc / 2.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement