Channel Equalization

24
Channel Equalization Po-Han Huang MS. Electrical Engineering [email protected] Abhinandan Majumdar MS Computer Engineering [email protected] Digital Signal Processing Final Project EE 4810 2007 Fall Professor Dan Ellis

Transcript of Channel Equalization

Page 1: Channel Equalization

Channel Equalization

Po-Han Huang

MS. Electrical Engineering

[email protected]

Abhinandan Majumdar

MS Computer Engineering

[email protected]

Digital Signal Processing Final Project

EE 4810

2007 Fall

Professor Dan Ellis

Page 2: Channel Equalization

I�DEX

1. I�TRODUCTIO� ..................................................................................................................1

1.1 Channel Equalization ..........................................................................................................1

1.2 Types ...................................................................................................................................2

1.2.1 Linear Equalizer ......................................................................................................2

1.2.2 Decision Feedback Equalizer ..................................................................................2

1.2.3 Adaptive Equalizer ..................................................................................................3

2. THEORY .................................................................................................................................4

2.1 The Problem Statement .......................................................................................................4

2.2 System Identification ..........................................................................................................4

2.3 Algorithm ............................................................................................................................6

3. RESULT ..................................................................................................................................7

3.1 Actual Input Signal for Sxx .................................................................................................7

3.1.1 Zero Phase Filter .....................................................................................................7

3.1.2 Linear Phase Filter ................................................................................................10

3.2 Different Signal for Sxx .....................................................................................................11

3.2.1 Zero Phase Filter ...................................................................................................12

3.2.2 Linear Phase Filter ................................................................................................13

3.3 Approximated Sxx .............................................................................................................14

3.3.1 Zero Phase Filter ...................................................................................................15

3.3.2 Linear Phase Filter ................................................................................................16

4. CO�CLUSIO� .....................................................................................................................18

4.1 Concise Result ..................................................................................................................18

4.2 Future Work ......................................................................................................................18

4.3 Experience .........................................................................................................................18

5. REFERE�CE ........................................................................................................................19

APPE�DIX ..................................................................................................................................20

Page 3: Channel Equalization

1. I�TRODUCTIO�

In audio processing, equalization is the process of changing the frequency envelope of a sound.

In passing through any channel, temporal/frequency spreading of a signal

it means to correct, or make equal, the frequency response of a signal. The term "equalizer" is

often incorrectly applied as a general term for audio filters. These are in fact general all

filters, which can be arranged to p

stop filters. Only when these filters are arranged so as to reverse the effects of the internal

circuitry on sound output, are they operating as equalizers.

1.1 Channel Equalization

To combat the distortive channel effects, or in other words, invert the FIR filter (time

or time-varying) representing the channel, a so

system, the transmitter sends the information over an RF channel.

channel, the signal gets distorted before actually it gets received at the receiver end. Hence, it is

the receiver ”task” is to figure out what signal was transmitted and turn the received signal in

understandable information.

The purpose of an equalizer is to reduce the ISI as much as possible to maximize the probability

of correct decisions.

1

I�TRODUCTIO�

In audio processing, equalization is the process of changing the frequency envelope of a sound.

In passing through any channel, temporal/frequency spreading of a signal occurs. Etymologically,

it means to correct, or make equal, the frequency response of a signal. The term "equalizer" is

often incorrectly applied as a general term for audio filters. These are in fact general all

filters, which can be arranged to produce the effect of low pass, high pass, band pass and band

stop filters. Only when these filters are arranged so as to reverse the effects of the internal

circuitry on sound output, are they operating as equalizers.

Channel Equalization

tortive channel effects, or in other words, invert the FIR filter (time

varying) representing the channel, a so-called equalizer is needed.

system, the transmitter sends the information over an RF channel. On passing th

channel, the signal gets distorted before actually it gets received at the receiver end. Hence, it is

receiver ”task” is to figure out what signal was transmitted and turn the received signal in

Fig 1.1 Inter symbol Interference

The purpose of an equalizer is to reduce the ISI as much as possible to maximize the probability

In audio processing, equalization is the process of changing the frequency envelope of a sound.

occurs. Etymologically,

it means to correct, or make equal, the frequency response of a signal. The term "equalizer" is

often incorrectly applied as a general term for audio filters. These are in fact general all-purpose

roduce the effect of low pass, high pass, band pass and band

stop filters. Only when these filters are arranged so as to reverse the effects of the internal

tortive channel effects, or in other words, invert the FIR filter (time-invariant

called equalizer is needed. In a communication

On passing through the

channel, the signal gets distorted before actually it gets received at the receiver end. Hence, it is

receiver ”task” is to figure out what signal was transmitted and turn the received signal in

The purpose of an equalizer is to reduce the ISI as much as possible to maximize the probability

Page 4: Channel Equalization

1.2 Types

1.2.1 Linear Equalizer

In a Linear Equalizer, t

weighted by equalizer coefficients a

below.

a) Zero forcing equalizer

without taking in consideration the resul

substantial increment of the noise power

b) Mean-Square Error equalizer

total error between the slicer input and the transmitted

1.2.2 Decision Feedback Equalizer

It is a simple nonlinear equalizer which is particulary useful for channel with severe

amplitude distortion. It

which have already have been detected.

already detected are known (past decisions are assumed correct), then the ISI contributed

by these symbols can be canceled exactly.

In a Decision Feedback Equalizer Architecture, t

may be adjusted simultaneously to minimize the M

2

a Linear Equalizer, the current and the past values of the received signal are linearly

equalizer coefficients and summed to produce the output, using the relation

Zero forcing equalizer – In such type of equalizers, it removes the complete ISI

ng in consideration the resulting noise enhacement

increment of the noise power.

Square Error equalizer – Such type of equlaizers attempt to minimize the

total error between the slicer input and the transmitted data symbol.

Decision Feedback Equalizer

imple nonlinear equalizer which is particulary useful for channel with severe

It uses desicion feedback to cancel the interferfence from symbols

which have already have been detected. The basic idea is that if the values of the symbols

already detected are known (past decisions are assumed correct), then the ISI contributed

by these symbols can be canceled exactly.

In a Decision Feedback Equalizer Architecture, the forward and feedback

may be adjusted simultaneously to minimize the Mean Square Error.

Fig 1.2 Decision Feedback Equalizer

he current and the past values of the received signal are linearly

nd summed to produce the output, using the relation

In such type of equalizers, it removes the complete ISI

ting noise enhacement. Using this, there is a

attempt to minimize the

data symbol.

imple nonlinear equalizer which is particulary useful for channel with severe

uses desicion feedback to cancel the interferfence from symbols

The basic idea is that if the values of the symbols

already detected are known (past decisions are assumed correct), then the ISI contributed

he forward and feedback coefficients

ean Square Error.

Page 5: Channel Equalization

1.2.3 Adaptive Equalizers

This type of equlaizers adapt the coefficients to minimize the noise and intersymbol

interference (depending on the

There are two modes that adaptive equalizers work;

a) Decision Directed Mode:

Decision directed equalizer adjustment is effective i

channel response. However, this approach is not effective during initial acqusition .

b) Training Mode: To make equalizer suitable in the initial acqusition duration, a training

signal is needed. In this mode of operation, the transmitter generates a data symbol

sequence known to the receiver.

Once an agreed time has elapsed, the slicer output is

actual data transmission begins.

3

This type of equlaizers adapt the coefficients to minimize the noise and intersymbol

interference (depending on the type of equalizer) at the output.

Fig 1.3 Adaptive Equalizers

There are two modes that adaptive equalizers work;

Decision Directed Mode: The receiver decisions are used to generate the error signal.

Decision directed equalizer adjustment is effective in tracking slow variations in the

channel response. However, this approach is not effective during initial acqusition .

To make equalizer suitable in the initial acqusition duration, a training

signal is needed. In this mode of operation, the transmitter generates a data symbol

sequence known to the receiver.

Once an agreed time has elapsed, the slicer output is used as a training

actual data transmission begins.

This type of equlaizers adapt the coefficients to minimize the noise and intersymbol

he receiver decisions are used to generate the error signal.

n tracking slow variations in the

channel response. However, this approach is not effective during initial acqusition .

To make equalizer suitable in the initial acqusition duration, a training

signal is needed. In this mode of operation, the transmitter generates a data symbol

training signal and the

Page 6: Channel Equalization

2. THEORY

2.1 The Problem Statement

The problem being dealt here is an unk

being passed through unknown channel. The object is to regenerate the original sample(X) from

the filtered sample(Y).

2.2 System Identification

In an Energy Density Spectrum

x[n] from Energy Density Spectrum of input signal S

This spectrum can be evaluated by taking the DTFTs of the autocorrelation sequence r

input sequence x[n] and the autocorrelation sequence r

a stable LTI discrete time system with an impulse response h[n],

And our application, the input signal x[n] is not known, this sys

computing the autocorrelation of the output signal y[n] defined by,

4

The Problem Statement

problem being dealt here is an unknown input signal X underwent unwanted filtering after

being passed through unknown channel. The object is to regenerate the original sample(X) from

Fig 2.1 Channel Equalization

System Identification

In an Energy Density Spectrum technique of system identification, we compute the input signal

x[n] from Energy Density Spectrum of input signal Sxx(���) and that of output signal S

This spectrum can be evaluated by taking the DTFTs of the autocorrelation sequence r

input sequence x[n] and the autocorrelation sequence ryy[l] of output sequence y[n]

a stable LTI discrete time system with an impulse response h[n],

���� � ������ ���

����

And our application, the input signal x[n] is not known, this system can be identified by

computing the autocorrelation of the output signal y[n] defined by,

input signal X underwent unwanted filtering after

being passed through unknown channel. The object is to regenerate the original sample(X) from

technique of system identification, we compute the input signal

) and that of output signal Syy(���).

This spectrum can be evaluated by taking the DTFTs of the autocorrelation sequence rxx[l] of

[l] of output sequence y[n]. Considering

tem can be identified by

Page 7: Channel Equalization

5

������ � ������� ���

����

From the above equations,

������ � � ������ ���

����� � �� ����� � + ���

�����

����

� ��� �� � ���

����� ��� ����� � + ���

�����

����

� ��� �� � ���

��������� � ��

����� ��� ⊛ � �� ⊛ ������

Hence, in the z – domain, the equation becomes,

����� � !�� !���" �����

where, ����� is the z – transform of ������. On the unit circle, the above equation reduces to

From, the above relation, the autocorrelation of the output signal can provide only the magnitude

response of the system but not the phase response.

���#���$ � %!#���$%&�������

Page 8: Channel Equalization

2.3 Algorithm

Here, we only have the filtered sample. Hence we kind of approximate S

average of various speech samples considered for our experiment. Hence, we find the

autocorrelation of the sequence y,

response of ryy as Syy. Then we perform division of S

the square root of it and divide it to Y which is the DTFT of output sample to get frequency

components of regenerated input sample. Then we perform Inverse DTFT by passing it through

IFFT block to get the regenerate input sample in time domain.

As discussed before, by this approach, we lose the phase information being added by the filter,

hence we need to make approximation on filter characteristics so as to minimize θ

θx ≈ θy. Hence in a nutshell, approximations being made are listed below.

a) We approximate on Sxx values by taking the DTFT of the

the input speech samples.

b) We approximate that the filter channel characteristics are that of zero phase or linear

phase filter so as θH ≈ 0.

6

Fig 2.2 Block Diagram of Algorithm

filtered sample. Hence we kind of approximate S

average of various speech samples considered for our experiment. Hence, we find the

autocorrelation of the sequence y, and then pass it through FFT block to get the Frequency

. Then we perform division of Syy and Sxx to get |H(z)|

the square root of it and divide it to Y which is the DTFT of output sample to get frequency

erated input sample. Then we perform Inverse DTFT by passing it through

IFFT block to get the regenerate input sample in time domain.

As discussed before, by this approach, we lose the phase information being added by the filter,

roximation on filter characteristics so as to minimize θ

. Hence in a nutshell, approximations being made are listed below.

We approximate on Sxx values by taking the DTFT of the autocorrelation

the input speech samples.

We approximate that the filter channel characteristics are that of zero phase or linear

≈ 0.

filtered sample. Hence we kind of approximate Sxx values, which is the

average of various speech samples considered for our experiment. Hence, we find the

pass it through FFT block to get the Frequency

to get |H(z)|2. Then we perform

the square root of it and divide it to Y which is the DTFT of output sample to get frequency

erated input sample. Then we perform Inverse DTFT by passing it through

As discussed before, by this approach, we lose the phase information being added by the filter,

roximation on filter characteristics so as to minimize θH, resultantly

autocorrelation of average of

We approximate that the filter channel characteristics are that of zero phase or linear

Page 9: Channel Equalization

7

3. RESULTS

For our experimentation purpose, we ran three type of simulation each with zero and linear phase

which are described in detail below.

3.1 Actual Input Signal for Sxx

3.1.1 Zero Phase Filter

Here we passed through a length 11 zero-phase FIR lowpass filter designed using the Remez

exchange algorithm. The matlab code for designing this filter is as follows:

N = 11; % filter length - must be odd b = [0 0.1 0.2 0.5]*2; % band edges M = [1 1 0 0 ]; % desired band values h = remez(N-1,b,M); % Remez multiple exchange design

The impulse response is returned in linear-phase form, so it must be left-shifted (N-1)/2 samples

to make it zero phase.

Figure 3.1: Impulse response and frequency response of a length 11 zero-phase FIR lowpass filter. Here the

frequency response is real because the filter is zero phase. Also plotted (in dashed lines) are the desired passband

and stopband gains.

Page 10: Channel Equalization

8

Figure 3.2 shows the amplitude and phase responses of the FIR filter designed by remez. The

phase response is zero throughout the passband and transition band. However, each zero-crossing

in the stopband results in a phase jump of π radians, so that the phase alternates between zero and

π in the stopband. This is typical of practical zero-phase filters.

Fig3.2 : Amplitude response and phase response of the length 11 zero-phase FIR lowpass filter in Fig.3.1.

We passed our original input sample through the zero phase filter generated, and here’s the

spectral analysis of the original and filtered sample showing the energies at lower frequencies are

kept intact while that of in higher frequencies are removed.

Fig 3.3 Spectrum of Original Signal and Filtered Signal (Zero-Phase)

Page 11: Channel Equalization

9

We compute sqrt(Syy/Sxx) which is the magnitude response of the unknown filter. By doing this,

we loose phase information and hence it remains 0 as shown in graph with small glitches in

middle.

Fig 3.4 Magnitude and Phase Response of the Zero Phase filter

After we got the filter response, we tried to regenrate x by dividing y by magnitude response of

filter obtained and did an inverse DTFT on that. Through this, we could successfully regenerate

original sample, and energy spectrum looks exactly same as per the original sample as per the

spectral analysis.

Fig 3.5 Spectrum of Original Signal and Regenerated Signal (Zero-Phase)

Page 12: Channel Equalization

10

3.1.2 Linear Phase Filter

For this, we used the same filter code without shifting it by (N-1)/2. Here is the spectrum of input

and filtered sample showing the energy in the higher frequency area are removed.

Fig 3.6 Spectrum of Original Signal and Filtered Signal (Linear-Phase)

The maginitude and phase response (almost zero as expected) obtained are as follows

Fig 3.7 Magnitude and Phase Response of the Linear Phase filter

Page 13: Channel Equalization

11

We could regenrate the input sample but had some ringing sound. In the spectral analysis, we see

some energy at higher frequency (blue spots) are missing in the regenerated sample.

Fig 3.8 Spectrum of Original Signal and Regenerated Signal (Linear-Phase)

3.2 Different Signal for Sxx

For this part of simulation, we took a completely different sample to approximate Sxx. Below is

the spectral analysis of the original sample and approximated sample.

Fig 3.9 Spectrum of Original Signal and Used Signal for Sxx

Page 14: Channel Equalization

12

3.2.1 Zero Phase Filter

Below is the magnitude and phase response which we could recover (some what corrupted).

Fig 3.10 Magnitude and Phase Response of the Zero Phase filter

After regeneration of the input sample, we found it similar to the input sample, but with lot of

noise being added in the background. From the spectral analysis, we see the input and

regenerated sample have similar enery spectrum but have lot of distortion in higher frequencies.

Fig 3.11 Spectrum of Original Signal and Regenerated Signal (Zero-Phase) (Using different signal for Sxx)

Page 15: Channel Equalization

13

3.2.2 Linear Phase Filter

We repeated the same process considering a Linear Phase Filter Channel, and got a corrupted

magnitude and phase response for the filter.

Fig 3.12 Magnitude and Phase Response of the Linear Phase filter

The regenerated sample sounded much like the original sample but with lot of noise being added

in background. Also, from the spectral analysis, the energy spectrum looks quite similar with lot

of distortion in higher frequency area.

Fig 3.13 Spectrum of Original Signal and Regenerated Signal (Linear-Phase) (Using different signal for Sxx)

Page 16: Channel Equalization

14

3.3 Approximated Sxx

Here we took a complete different input sample, and used three samples which was the same

speech but spoken by different speaker and at different timing. Here is the spectral analysis of

three samples with energy spectrum similar but different in sense of timing and frequency.

Fig 3.14 Spectrum of Sample 1,Sample 2 and Sample 3

To approximate Sxx, we took the average of the frequency components of their autocorrelation

values. This is because Sxx values for a human speech are nearly same, hence taking an average

of different samples.

Fig 3.15 Sxx Magnitude of Sample 1,Sample 2 and Sample 3

Page 17: Channel Equalization

15

3.3.1 Zero Phase Filter

This is the spectrum of original sample, after being passed through low pass zero phase filter,

which enerdies removed at higher frequencies.

Fig 3.16 Spectrum of Original Signal and Filtered Signal (Zero-Phase)

Here’s the magnitude and phase response of the filter. It looks less corrupted and more close to

the original filter response as obtained in 3.1.1.

Fig 3.17 Magnitude and Phase Response of the Zero Phase filter

Page 18: Channel Equalization

16

The regenerated sample sounded less noisy than that of 3.2.1. Also the energy spectrum is more

close to the original at lower frequencies.

Fig 3.18 Spectrum of Original Signal and Regenerated Signal (Zero-Phase) (Using Average of 3 samples for Sxx)

3.3.2 Linear Phase Filter

When passed through Linear Phase , it removes the energy at higher frequency.

Fig 3.19 Spectrum of Original Signal and Filtered Signal (Linear-Phase)

Page 19: Channel Equalization

17

The magnitude response of the filter appears more closer to the original one that 3.1.2 than 3.2.2

Fig 3.20 Magnitude and Phase Response of the Linear Phase filter

The regenerated sample sounded less noisy than that of 3.2.2 case. Also through the spectral

analysis, enery spectrum at lower frequency are nearly same and less noisy than 3.2.2.

3.21 Spectrum of Original Signal and Regenerated Signal (Linear-Phase) (Using Average of 3 samples for Sxx)

Page 20: Channel Equalization

18

4. CO�CLUSIO�

4.1 Concise Result

From the simulation, we could finally summarize following results

Values used of Sxx Filter Type Result

Original Sample

Zero Phase Regenerated Exact Input Sample

Linear Phase Regained Original Sample with feeble ringing

sound

Different Sample Zero Phase Regenerated Noisy Input Sample

Linear Phase Regenerated Noisy Input Sample

Average of various

Sample

Zero Phase Regenerated Less Noisy Input Sample

Linear Phase Regenerated Less Noisy Input Sample

4.2 Future Work

From the work done, we can have better approximation algorithms so as the regenerated sample

is more close both in terms of magnitude and phase, closer to the original sample. Also, as this

approach of System Identification has a major contraint of losing the phase response of the filter,

this technique cannot be used for general case, and hence lot of approximation on the filter

specification has to be done. For other filter like that of IIR filters such as Butterforth or

Elliptical filter, this technique could be used to recover the magnitude response of the sample, so

if we have a technique to predict the phase modification being added by the filter, we can recover

the original sample.

4.3 Experience

Working directly upon the filter characteristics, modifying its properties, playing with sound

samples, analyzing the sound spectrum and comparing various tradeoffs affecting equalization

characteristics gave us a through insight upon a real world problem. Also it gave us an

experience of implementing the theoritical aspect of Digital Signal Processing over an actual

application. Hence, we are kind of thankful to everyone especially Prof. Dan Ellis and TA Wei

Jiang, whose constant guidance and motivation saved our work to go into pitfalls.

Page 21: Channel Equalization

19

5. REFERE�CES

[1] Digital Signal Processing – Sanjit Mitra

[2] Channel Equalization Techniques by Fernando Gregorio.

[3] http://en.wikipedia.org/wiki/Equalization

[4] Blind System Identification and Channel Equalization of IIR Systems without Statistical

Information, Signal Processing, IEEE Transactions on Acoustics, Speech, and Signal

Processing, Erwei Bai and Minyue Fu.

Page 22: Channel Equalization

20

APPE�DIX

Code for 3.1.1, 3.1.2, 3.2.1, 3.2.2

num = 512*64; a = 0; %Start from the beginning (a=0), a can be 0~77482 [x,r] = wavread('mssp3.wav'); %ORIGINAL Sound [x2,r] = wavread('mssp2.wav'); %Another Sound x=x(a+1:a+num); % shorten the original sound(110250) into (32768) x2=x2(a+1:a+num); N = 11; % filter length - must be odd b = [0 0.1 0.2 0.5]*2; % band edges M = [1 1 0 0 ]; % desired band values h = remez(N-1,b,M); % Remez multiple exchange design hh = h(6:N); % Shift (N-1)/2=5 samples to make h zero-phase hh(7:11) = 0; % Pass it through the filter y = filter(hh,1,x); % Zero Phase Ly = filter(h,1,x); % Linear Phase % Autocorrelation rxx=xcorr(x(1:num)); %AutoCorrelation:using Original signal as estimated x rxx2=xcorr(x2(1:num)); %AutoCorrelation:using Different signal as estimated x ryy=xcorr(y); rLyy=xcorr(Ly); rxysize = size(rxx); num1 = 2^ceil(log2(rxysize(1))); %make num into even Ex.65535 into 65536 % Do FFT to get frequency response of autocorrelation sxx = fft(rxx,num1); sxx2= fft(rxx2,num1); syy = fft(ryy,num1); sLyy = fft(rLyy,num1); Y = fft(y,num1); LY =fft(Ly,num1); for i = 1 : num1 if (syy(i) == 0) XX(i) = 999999999999999; XX2(i) = 999999999999999; else

%|!�i | &= syy(i)/sxx(i); XX(i)=Y(i)/H(i) XX(i) = Y(i)*sqrt(abs(sxx(i)/syy(i))); XX2(i)= Y(i)*sqrt(abs(sxx2(i)/syy(i))); end end for i = 1 : num1 if (sLyy(i) == 0) LXX(i) = 999999999999999;

Page 23: Channel Equalization

21

LXX1(i) = 999999999999999; else

%%|!�i | &= syy(i)/sxx(i); XX(i)=Y(i)/H(i) LXX(i) = LY(i)*sqrt(abs(sxx(i)/sLyy(i))); LXX1(i) = LY(i)*sqrt(abs(sxx2(i)/sLyy(i))); end end xx = ifft(XX,num1); xx2 = ifft(XX2,num1); Lxx= ifft(LXX,num1); Lxx1= ifft(LXX1,num1); % Zero-Phase Filter case soundsc(x,r); %Original Sound soundsc(y,r); %Original Sound passed through Zero-Phase Filter soundsc(xx,r); %Regenerated signal by using original signal as estimated x soundsc(xx2,r); %Regenerated signal by using other signal as estimated x % Linear-Phase Filter case soundsc(x,r); %Original Sound soundsc(Ly,r); %Original Sound passed through Linear-Phase Filter soundsc(Lxx,r); %Regenerated signal by using original signal as estimated x soundsc(Lxx1,r);%Regenerated signal by using other signal as estimated x

Code for 3.3.1, 3.3.2

num = 512*64; [x,r] = wavread('sf1_cln.wav'); %ORIGINAL Sound [x1,r] = wavread('sf2_cln.wav'); %BASE Sound [x2,r] = wavread('sf3_cln.wav'); %BASE Sound x=x(1:num); N = 11; % filter length - must be odd b = [0 0.1 0.2 0.5]*2; % band edges M = [1 1 0 0 ]; % desired band values h = remez(N-1,b,M); % Remez multiple exchange design hh = h(6:N); % Shift (N-1)/2=5 samples to make h zero-phase hh(7:11) = 0; % Pass it through the filter y = filter(hh,1,x); % Zero Phase Ly = filter(h,1,x); % Linear Phase % Autocorrelation rxx=xcorr(x(1:num)); %AutoCorrelation: ORIGINAL Sound rxx1=xcorr(x1(1:num)); %AutoCorrelation: BASE Sound rxx2=xcorr(x2(1:num)); %AutoCorrelation: BASE Sound ryy=xcorr(y); rLyy=xcorr(Ly); rxysize = size(rxx); num1 = 2^ceil(log2(rxysize(1))); %make num into even Ex.65535 into 65536 % Do FFT to get frequency response of autocorrelation sxx = fft(rxx,num1); sxx1= fft(rxx1,num1); sxx2= fft(rxx2,num1); sxx3= (sxx+sxx1+sxx3)/3; %Average the original and base sound as estimated Sxx syy = fft(ryy,num1); sLyy = fft(rLyy,num1);

Page 24: Channel Equalization

22

Y = fft(y,num1); LY =fft(Ly,num1); % Zero-Phase Filter for i = 1 : num1 if (syy(i) == 0) XX(i) = 999999999999999; else

%|!�i | &= syy(i)/sxx(i); XX(i)=Y(i)/H(i) XX(i) = Y(i)*sqrt(abs(sxx3(i)/syy(i))); end end % Linear-Phase Filter for i = 1 : num1 if (sLyy(i) == 0) LXX(i) = 999999999999999; else

%%|!�i | &= syy(i)/sxx(i); XX(i)=Y(i)/H(i) LXX(i) = LY(i)*sqrt(abs(sxx3(i)/sLyy(i))); end end xx = ifft(XX,num1); Lxx= ifft(LXX,num1); % Zero-Phase Filter case soundsc(x,r); %Original Sound soundsc(y,r); %Original Sound passed through Zero-Phase Filter soundsc(xx,r); %Regenerated signal by using average spectrum as Sxx % Linear-Phase Filter case soundsc(x,r); %Original Sound soundsc(Ly,r); %Original Sound passed through Linear-Phase Filter soundsc(Lxx,r); %Regenerated signal by using average spectrum as Sxx