| 1 |
function f = generate_filter (cycles, fudge_factor, increment, atten) |
| 2 |
|
| 3 |
if nargin != 4, |
| 4 |
error ("Need four args.") ; |
| 5 |
endif |
| 6 |
|
| 7 |
# Calclate N and make sure it is even. |
| 8 |
N = fix (4 * cycles * fudge_factor * increment) ; |
| 9 |
|
| 10 |
if rem (N, 2) != 0, |
| 11 |
N = N - 1 ; |
| 12 |
endif |
| 13 |
|
| 14 |
# Generate the Sinc function. |
| 15 |
|
| 16 |
m = -((N-1)/2):((N-1)/2) ; |
| 17 |
f = sinc (m / fudge_factor / increment) ; |
| 18 |
|
| 19 |
# Genertate the window function and apply it. |
| 20 |
|
| 21 |
w = kaiser (N, (atten + 0.5) / 10) ; |
| 22 |
w = w' ; |
| 23 |
|
| 24 |
f = f .* w ; |
| 25 |
|
| 26 |
f = f / sum (f) ; |
| 27 |
|
| 28 |
endfunction |
| 29 |
|
| 30 |
# Do not edit or modify anything in this comment block. |
| 31 |
# The arch-tag line is a file identity tag for the GNU Arch |
| 32 |
# revision control system. |
| 33 |
# |
| 34 |
# arch-tag: 7e57a3cb-3f5c-4346-bfcd-4da1e758e2a7 |
| 35 |
|