Digital Signal Processing Reference
In-Depth Information
respectively. Note that the right input channel (Right Line In [RCI]) is not used. When the input
frequency is swept from 200 Hz to 3,000 Hz, the output shows a maximum peak when the input
frequency is dialed to around 1,500 Hz. Hence, the adaptive filter acts like the unknown system.
Program 10.4 gives the sample program segment.
Program 10.4. Program segment for system modeling.
/*Numerator coefficients */
/*for the bandpass filter (unknown system) with fL ¼ 1.4 kHz, fH ¼ 1.6 kHz*/
float b[5] ¼ { 0.005542761540433, 0.000000000000002, -0.011085523080870,
0.000000000000003 0.005542761540431};
/*Denominator coefficients */
/*for the bandpass filter (unknown system) with fL ¼ 1.4 kHz, fH ¼ 1.6 kHz*/
float a[5] ¼ { 1.000000000000000, -1.450496619180500. 2.306093105231476,
-1.297577189144526 0.800817049322883};
float x[40] ¼ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /*Reference input buffer*/
float w[40] ¼ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /*Adaptive filter coefficients*/
float d[1] ¼ {0.0}; /*Unknown system output */
float y[1] ¼ {0,0}; /*Adaptive filter output */
float e[1] ¼ {0.0}; /*Error signal */
float mu
0.000000000002; /*Adaptive filter convergence factor*/
interrupt void c_int11()
{
¼
float lc; /*left channel input */
float rc; /*right channel input */
float lcnew; /*left channel output */
float rcnew; /*right channel output */
int i;
//Left channel and right channel inputs
AIC23_data.combo ¼ input_sample();
lc ¼ (float) (AIC23_data.channel[LEFT]);
rc ¼ (float) (AIC23_data.channel[RIGHT]);
// Insert DSP algorithm below
for(i ¼ 39;i>0;i--) /*Update the input buffer*/
{ x[i] ¼ x[i-1]; }
x[0] ¼ lc;
d[0] ¼ b[0]*x[0] þ b[1]*x[1] þ b[2]*x[2] þ b[3]*x[3] þ b[4]*x[4]
-a[1]*d[1]-a[2]*d[2]- a[3]*d[3]- a[4]*d[4]; /*Unknown system output*/
// Adaptive filter
y[0] ¼ 0;
for(i ¼ 0;i<40; i þþ )
{ y[0] ¼ y[0] þ w[i]*x[i];}
e[0] ¼ d[0]-y[0]; /* Error output */
for(i ¼ 0;i<40; i þþ )
{ w[i] ¼ w[i] þ 2*mu*e[0] *x[i];} /* LMS algorithm */
// End of the DSP algorithm
lcnew
¼
y[0]; /* Send the tracked output */
Search WWH ::




Custom Search