|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
均衡器Matlab例程(1)解析
Equalizing Using a Training Sequence
例程代码
% Set up parameters and signals.
M = 4; % Alphabet size for modulation
msg = randint(1500,1,M); % Random message,产生一个1500 x 1 在[0,M-1]区域内的随机整数序列
modmsg = pskmod(msg,M); % Modulate using QPSK. 进行QPSK调制的映射
trainlen = 500; % Length of training sequence 定义训练序列的帧长
chan = [.986; .845; .237; .123+.31i]; % Channel coefficients 定义信道参量
filtmsg = filter(chan,1,modmsg); % Introduce channel distortion. 模拟信道变化
% Equalize the received signal.
eq1 = lineareq(8, lms(0.01)); % Create an equalizer object.
eq1.SigConst = pskmod([0:M-1],M); % Set signal constellation. 设置星座图
[symbolest,yd] = equalize(eq1,filtmsg,modmsg(1:trainlen)); % Equalize.
% Plot signals.
h = scatterplot(filtmsg,1,trainlen,'bx'); hold on; 以蓝星画出未经过均衡的信号
scatterplot(symbolest,1,trainlen,'g.',h); 在原图的基础上以绿色画出经过均衡后的信号
scatterplot(eq1.SigConst,1,0,'k*',h); 在原图的基础上以黄色标出理想星座图
legend('Filtered signal','Equalized signal',...
'Ideal signal constellation');
hold off;
% Compute error rates with and without equalization. 计算误码率
demodmsg_noeq = pskdemod(filtmsg,M); % Demodulate unequalized signal. 解调未均衡的码字
demodmsg = pskdemod(yd,M); % Demodulate detected signal from equalizer.解调已均衡的码字
[nnoeq,rnoeq] = symerr(demodmsg_noeq(trainlen+1:end),...对比未均衡信号和样本信号的误码和误码率
msg(trainlen+1:end));
[neq,req] = symerr(demodmsg(trainlen+1:end),...
msg(trainlen+1:end)); 对比均衡信号和样本信号的误码和误码率
disp('Symbol error rates with and without equalizer:')
disp([req rnoeq]
希望能得到高手的指点,红色部分参数不是很明白,万分感谢 |
|