3 * Copyright 2002 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
24 * generate MMSE FIR interpolation table values
31 #define MU 0.5 /* the MU for which we're computing coeffs */
33 #define Ts (1.0) /* sampling period */
34 #define B (1.0/(4*Ts)) /* one-sided signal bandwidth */
35 //#define B (1.0/(8./3*Ts)) /* one-sided signal bandwidth */
37 static unsigned global_n;
38 static double *global_h;
39 double global_mu = MU;
43 * This function computes the difference squared between the ideal
44 * interpolator frequency response at frequency OMEGA and the
45 * approximation defined by the FIR coefficients in global_h[]
47 * See eqn (9-7), "Digital Communication Receivers", Meyr, Moeneclaey
48 * and Fechtel, Wiley, 1998.
52 integrand (double omega)
65 real_ideal = cos (omega * Ts * global_mu);
66 imag_ideal = sin (omega * Ts * global_mu);
75 for (i = 0; i < n; i++){
76 real_approx += h[i] * cos (-omega * Ts * (i + I1));
77 imag_approx += h[i] * sin (-omega * Ts * (i + I1));
80 real_diff = real_ideal - real_approx;
81 imag_diff = imag_ideal - imag_approx;
83 return real_diff * real_diff + imag_diff * imag_diff;
87 * Integrate the difference squared over all frequencies of interest.
90 c_fcn (double *x, int n)
92 assert ((n & 1) == 0); /* assert n is even */
95 return qsimp (integrand, -2 * M_PI * global_B, 2 * M_PI * global_B);
98 /* this is the interface expected by the calling fortran code */
101 objective (double x[], int *ndim)
103 return c_fcn (x, *ndim);
116 * starting guess for optimization
118 void initpt (double x[], int ndim)
121 for (i = 0; i < ndim; i++){
122 x[i] = si (M_PI * ((double) (i - ndim/2) + global_mu));