# Zero forcing EQ question

Started by December 8, 2005
```Hello All!
I obtained a matlab code which do the zero forcing equalization on
an awgn channel, and plots the BER vs. SNR
Please look at this small  code if it is correct, my question is:
where are the filter coefficients here or how can I obtain this, as I don't
see them ???
Thanks for you effort,
Reno

N: number of symbols we transmit
h: impulse response
snrDB: SNR in dB, actually:
snrdB_min = 1; snrdB_max = 10;
snrdB = snrdB_min:1:snrdB_max;
-----

function z = zf(N,h,snrdB)

lg=length(h);
y=sign(randn(1,N));
sk=filter(h,1,y);
snr=10.^(snrdB/10);

nu=normrnd(0,(1/sqrt(snr)),1,N);
x=sk+nu;
ykegalZF=filter(1,h,x);
aklinZF=sign(ykegalZF(1:N));
PelinZF=sum(abs(y-aklinZF)/2);
errorZF=PelinZF/N;

%semilogy(RSBdB, PelinZF,'r*'); hold on;

-------

```
```"August Reno" <a_reno@tiscali.it> wrote in message
news:dna3i9\$5d0\$1@namru.matavnet.hu...
> Hello All!
> I obtained a matlab code which do the zero forcing equalization on
> an awgn channel, and plots the BER vs. SNR
> Please look at this small  code if it is correct, my question is:
> where are the filter coefficients here or how can I obtain this, as I
> don't see them ???
> Thanks for you effort,
> Reno
>
>
> N: number of symbols we transmit
> h: impulse response
> snrDB: SNR in dB, actually:
> snrdB_min = 1; snrdB_max = 10;
> snrdB = snrdB_min:1:snrdB_max;
> -----
>
> function z = zf(N,h,snrdB)
>
> lg=length(h);
> y=sign(randn(1,N));
> sk=filter(h,1,y);
> snr=10.^(snrdB/10);
>
> nu=normrnd(0,(1/sqrt(snr)),1,N);
> x=sk+nu;
> ykegalZF=filter(1,h,x);
> aklinZF=sign(ykegalZF(1:N));
> PelinZF=sum(abs(y-aklinZF)/2);
> errorZF=PelinZF/N;
>
> %semilogy(RSBdB, PelinZF,'r*'); hold on;

Just read the definition for "filter" and you'll see how the coefficients
are used.
The coefficients are "h" and are *inputs* to the function.....

Fred

```
```Thank you I figured it out!
August
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> az al&#2013265921;bbiakat &#2013265933;rta a
k&#2013266166;vetkez&#2013266165; h&#2013265933;r&#2013266172;zenetben: QrmdnfzrdvW0mgTenZ2dnUVZ_tudnZ2d@centurytel.net...
>
> "August Reno" <a_reno@tiscali.it> wrote in message
> news:dna3i9\$5d0\$1@namru.matavnet.hu...
>> Hello All!
>> I obtained a matlab code which do the zero forcing equalization on
>> an awgn channel, and plots the BER vs. SNR
>> Please look at this small  code if it is correct, my question is:
>> where are the filter coefficients here or how can I obtain this, as I
>> don't see them ???
>> Thanks for you effort,
>> Reno
>>
>>
>> N: number of symbols we transmit
>> h: impulse response
>> snrDB: SNR in dB, actually:
>> snrdB_min = 1; snrdB_max = 10;
>> snrdB = snrdB_min:1:snrdB_max;
>> -----
>>
>> function z = zf(N,h,snrdB)
>>
>> lg=length(h);
>> y=sign(randn(1,N));
>> sk=filter(h,1,y);
>> snr=10.^(snrdB/10);
>>
>> nu=normrnd(0,(1/sqrt(snr)),1,N);
>> x=sk+nu;
>> ykegalZF=filter(1,h,x);
>> aklinZF=sign(ykegalZF(1:N));
>> PelinZF=sum(abs(y-aklinZF)/2);
>> errorZF=PelinZF/N;
>>
>> %semilogy(RSBdB, PelinZF,'r*'); hold on;
>
> Just read the definition for "filter" and you'll see how the coefficients
> are used.
> The coefficients are "h" and are *inputs* to the function.....
>
> Fred
>

```