Monday, 29 June 2015

Adaptive filter for equalization


·       To know how to identify a system using Adaptive filtering
·        To investigate the “Adaptive filter for equalization”

Equipment and tools:

·        A computer having code composedly studio and Matlab.
·        A 6713dsk toolkit.
·        A picoscope.


System identification an be accomplished by using the adaptive filter be connecting both the unknown system and the adaptive filter in parallel as shown in Figure 3. A random test signal is applied as an input for both the unknown system and the adaptive filter.
The error signal  is the difference between the response of the unknown system   and the response of the adaptive filter . This error signal is fed back to the adaptive filter and is used to update the adaptive filter’s coefficients until the overall output .When this happens, the adaptation process is finished, and   
approaches zero. If the unknown system is linear and not time-varying, then after the adaptation is complete, the filter’s characteristics no longer change. In this scheme, the adaptive filter models the unknown system. 

Figure 1Adaptive filter structure for system identification.
Inverse system modeling (e.g. channel equalization in modems) which is shown in fig-4
Figure 2 adaptive filter for system modeling.
1.     Adaptive predictor. Figure 4 shows an adaptive predictor structure that can provide an estimate of an input. This structure is illustrated later with a programming example.

Figure 3Adaptive predictor structure.

Experimental procedures

An extra memory location is used in each of the two delay sample buffers (fixedand adaptive FIR). This is used to update the delay samples (see method B inExample 4.8in Rulphchassing).
1.     Design an FIR band pass filter with a center frequency of , bandwidth of 400 Hz. Use 55 coefficients in designing the filter. Export the filter coefficients to a file called  bp55.cof
2.     Use the following header file required for the random noise generation in your project directory
//Noise_gen.h header file for pseudo-random noise sequence

typedefstruct BITVAL    //register bits to be packed as integer
 unsigned int b0:1, b1:1, b2:1, b3:1, b4:1, b5:1, b6:1;
 unsigned int b7:1, b8:1, b9:1, b10:1, b11:1, b12:1,b13:1;
 unsigned int dweebie:2; //Fills the 2 bit hole - bits 14-15
} bitval;

typedef union SHIFT_REG
 unsigned intregval;
} shift_reg;
3.     Build and run this project as adaptIDFIR. Verify that the output (adaptfir_out) of the adaptive FIR filter converges to a bandpass filter centered at 2kHz(with the slider in position 1 by default).
4.     With the slider in position 2, verify the output (fir_out) of the fixed FIR bandpass filter centered at 2 kHz and represented by the coefficient file bp55.cof. It can be observed that this output is practically identical to the adaptive filter’s output.
#include "DSK6713_AIC23.h" //codec-DSK support file
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
#include "bp55.cof" //fixed FIR filter coefficients
#include "noise_gen.h" //support noise generation file
#define beta 1E-14 //rate of convergence
#define WLENGTH 60 //# of coefffor adaptive FIR
float w[WLENGTH+1]; //buffer coeff for adaptive FIR
intdly_adapt[WLENGTH+1]; //buffer samples of adaptive FIR
intdly_fix[N+1]; //buffer samples of fixed FIR
short out_type = 1; //output for adaptive/fixed FIR
intfb; //feedback variable
shift_regsreg; //shift register
intprand(void) //pseudo-random sequence {-1,1}
if( prnseq = -8000; //scaled negative noise level
else prnseq = 8000; //scaled positive noise level
fb =(^(; //XOR bits 0,1
fb^=(^(; //with bits 11,13 ->fb
sreg.regval<<=1;; //close feedback path
return prnseq; //return noise sequence
interrupt void c_int11() //ISR
int i;
intfir_out = 0; //init output of fixed FIR
intadaptfir_out = 0; //init output of adapt FIR
float E; //error=diff of fixed/adapt out
dly_fix[0] = prand(); //input noise to fixed FIR
dly_adapt[0]=dly_fix[0]; //as well as to adaptive FIR
for (i = N-1; i>= 0; i--)
fir_out +=(h[i]*dly_fix[i]); //fixed FIR filter output
dly_fix[i+1] = dly_fix[i]; //update samples of fixed FIR
for (i = 0; i < WLENGTH; i++)
adaptfir_out +=(w[i]*dly_adapt[i]); //adaptive FIR filter output
E = fir_out - adaptfir_out; //error signal
for (i = WLENGTH-1; i >= 0; i--)
w[i] = w[i]+(beta*E*dly_adapt[i]); //update weights of adaptive FIR
dly_adapt[i+1] = dly_adapt[i]; //update samples of adaptive FIR
if (out_type == 1) //slider position for adapt FIR
output_sample((short)adaptfir_out); //output of adaptive FIR filter
else if (out_type == 2) //slider position for fixed FIR
output_sample((short)fir_out); //output of fixed FIR filter
void main()
int T=0, i=0;
for (i = 0; i < WLENGTH; i++)
w[i] = 0.0; //initcoeff for adaptive FIR
dly_adapt[i] = 0; //init buffer for adaptive FIR
for (T = 0; T < N; T++)
dly_fix[T] = 0; //init buffer for fixed FIR
sreg.regval=0xFFFF; //initial seed value
fb = 1; //initial feedback value
comm_intr(); //init DSK, codec, McBSP
while (1); //infinite loop


·        Here we can see that the adaptive filter has identified the unknown system which is the band pass filter we generated in step 1 using fdatool.


·        The adaptive filter can be used to identify any system using the block diagram shown in figure 1.

·        Adaptive equalizer is used to compensate for the distortion caused by the transmission medium (channel).

No comments: