📄 receiver_lmmse.m
字号:
%+----------------------------------------------------------------+
%| |
%| Name: receiver_lmmse.m |
%| Author: James Shen |
%| Description: Takes ina signal and tries to demodulate it. |
%| We assume that we are receiving pilot signals so that the |
%| desired signal is know already. What happens in a real |
%| implementation is that the equalizer coefficients derived |
%| will continue to be used with data and the desired signal |
%| will then be the decovered signal. This will accumulate |
%| errors in the coefficients until the next batch of |
%| pilot symbols arrive. Receives one OFDM. |
%| |
%+----------------------------------------------------------------+
function[recovered_signal,w, error1] = ...
receiver_lmmse(desired_signal, noisy_signal, input_symbols, FFTLen, CPLen, M, w, SNRdB);
%============== Gaurd Interval Removal (GIR) ==================
% Remove cyclic extension from desired signal.
desired_time_serial = desired_signal((CPLen+1):FFTLen+CPLen);
% Remove cyclic extension from noisy signal.
noisy_time_serial = noisy_signal((CPLen+1):FFTLen+CPLen);
%================= Serial To Parallel =================================
output_time_para = reshape(noisy_time_serial,FFTLen,1);
%================= FFT =================================
output_noisy_symbols = fft(output_time_para);
%============== Zero Forcing Equalizer ========================
% LS channel estimator in frequency domain
h_est = output_noisy_symbols ./ input_symbols;
% LMMSE equalizer
SNR = 10^(SNRdB/10);
new_w = conj(h_est) ./ ( abs(h_est).^2 + 1/SNR);
output_symbols = output_noisy_symbols .* w;
%================= Baseband Demodulation ===========================
output_para = qamdemod(output_symbols,FFTLen, M);
%================ Parallel to Serial ====================
output = reshape(output_para,1,FFTLen*M); % Time domain signal
%================ Returning output ===============================
recovered_signal = output;
w = new_w;
% The code below should be commented out when
% running for more than one iteration as it just
% shows graphs for one symbol
%================ Error Calculation ===========================
%figure(1);
%plot(abs(input_symbols), 'bx'); hold on;
%plot(abs(output_symbols), 'ro'), ...
% title('Transmitted Symbols vs Equalized Symbols vs Unequalized Symbols');
%plot(abs(output_noisy_symbols), 'gd'), ...
% legend('Tansmitted Symbols','Equalized Symbols','Unequalized Symbols') ...
% ,ylabel('Amplitude'), xlabel('Symbol'); hold off;
error1= input_symbols - output_symbols;
%================ Graphs ===========================
%figure(2);
%semilogy(abs(desired_signal), 'b'); hold on;
%semilogy(abs(output_ext), 'r'); hold off;
%figure(3);
%semilogy(abs(e));
%=============== END FILE ================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -