Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Return RC low-pass filter output samples, given input samples,
- // time interval dt, and time constant RC
- function lowpass(real[0..n] x, real dt, real RC)
- var real[0..n] y
- var real α := dt / (RC + dt)
- y[0] := x[0]
- for i from 1 to n
- y[i] := α * x[i] + (1-α) * y[i-1]
- return y
- input: an array a of length n with array elements numbered 0 to n − 1
- inc ← round(n/2)
- while inc > 0 do:
- for i = inc .. n − 1 do:
- temp ← a[i]
- j ← i
- while j ≥ inc and a[j − inc] > temp do:
- a[j] ← a[j − inc]
- j ← j − inc
- a[j] ← temp
- inc ← round(inc / 2.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement