Implementing an Adaptive Equalizer using LMS algorithm

2 次查看(过去 30 天)
Hello i have an assignment in which i must create an Adaptive Equalizer using the LMS algorithm. I have provided Some key information about the assignment:
1st. I must create a data generator module used in order to create a sequence of complex valued information symbols s[n]. For this experiment we will assume QPSK symbols, or in other words that s[n] must be drawn from the set{a+ja,a−ja,−a+ja,−a−ja}, where a represents the signal amplitude that is chosen according to a given signal-to-noise ratio (SNR) defined as SNR = 20 log10(√2a).
2nd. we must pass this data through an FIR filter with impulse response c[n] that simulates channel distortion
3rd. i must implement a noise generator module used in order to generate additive noise which can be implemented using this command,(1/sqrt(2))*(randn(1,N)+j*randn(1,N)),which generates a vector of N noise samples.
4th.The adaptive equalizer module implemented must be an FIR filter of length M+1 labeled as h[n] whose coefficients are adjusted using either the LMS or the normalized-LMS algorithm. use the complex version of the filter
5th. I must implement a decision device module that takes the output of the equalizer and quantizes it to one of the four possible transmitted symbols, based on whichever is closest. This module is necessary when your equalizer is operating in decision-directed mode, where the detected symbols are used to train the filter.
List of parameters: run the full experiment a total of P times, then you will have P different values of the equalizer input and output for each time sample n, where n= 0,···,N−1. plot the error e[n]as a function of n, averaged over the P experiments. input variables: a vector c containing the channel impulse response, the SNR in dB, the step size μ for the fixed-step LMS equalizer, the length M of the equalizer filter h, the number of training samples T used to initially train the filter,the number of total samples N per experiment, and the total number P of experiments used to plot the results and compute the average error.
This is a sample of the code i have so far, im currently stuck and have zero idea on how to implement this any help with anything or tips on how to get started would be helpful and appreciated thanks
function [yr,y1,yo,errorr,err1,errn,y] = adap_equallize(chan_a,chan_b,snr,mu,M,L,T,N,P); %N = length(x); %e = zeros(1,N); %y = zeros(1,N); %u = zeros(1,M); %W = zeros(M,N); N = 300 symbSet = [1+1j, 1-1j, -1+1j, -1-1j]; %generate QPSK data randIdx = randi(4,N,1) symbSet(randIdx)' s_n = zeros(length(symbSet(randIdx)',N)); %{ for for k = N:-1:1 symbSet(k) = symbSet(k-1); end %} %{ c = 0; for k=0:N c = symbset*q(k)'; end n = (1/sqrt(2))*(randn(1,N)+1i*randn(1,N))'; x=c+n; %}
%scatter(real(symbSet),imag(symbSet))%plot data %{ J_vec = zeros(length(D),N); % vector for storing values of MSE V_w = zeros(M,length(D)); % vector for storing the estimated coefficients
sn = sign(randi(1,N)-0.5);
SNR = mag2db(sqrt(2)*a) for k =1:N u = [x(k),u(1:M-1)]; % Vector containg the input signal for which the % weights are non zero y(k) = u*w; e(k)= d(k)-y(k); w = w+mu*u'*e(k); W(:,k) = w; end
%section that includes input variables
%step size mu = 0.01; %length of equalizer filter h M = 10; %number of training samples to initially train the filter T = 30; %number of total samples per experiment N = 300; %total number P of experiments used to plot reults P = 100;
lambda = 0.00005; N = 300;
s_n = randi([0 N-1],1000,1); n = (1/sqrt(2))*(randn(1,N)+1i*randn(1,N)); M = 10;
symbSet = [a+aj,a-aj,-a+aj,-a-aj]; SNR = mag2db(sqrt(2)*a);
for k = N-1:-1:0 q(k) = q(k-1); end c = 0; for k=0:N c = s_n(k)*q(k); end x=c+n;
for k = M-1:-1:0 x(k) = x(k-1); end s_hat = 0; for k =0:M+1 s_hat = h(k)*x(k); end
e = x-s_hat;
mu = 0;
for k=0:N mu = mu+x(k)*x(k); end mu = 1/mu;
for k=0:N h(k) = lambda*mu*e*x(k); end %}

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Equalization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by