%% Equalize MMSE for RMC R.5
% This example applies MMSE equalization on the received signal for reference measurement channel (RMC) R.5, after channel estimation.
% Set the DL reference measurement channel to R.5

enb = lteRMCDL('R.5');

%
% Set channel estimator configuration PilotAverage field to UserDefined. as follows: averaging window of 9 resource elements in both frequency and time domain, cubic interpolation with a casual window.

cec = struct('FreqWindow',9,'TimeWindow',9,'InterpType','cubic');
cec.PilotAverage = 'UserDefined';
cec.InterpWinSize = 1;
cec.InterpWindow = 'Causal';

%
% Generate the txWaveform.

txWaveform = lteRMCDLTool(enb,[1;0;0;1]);
n = length(txWaveform);

%
% Apply some random noise to the transmitted signal and save as the rxWaveform.

rxWaveform = repmat(txWaveform,1,2)+complex(randn(n,2),randn(n,2))*1e-3;

%
% Next, demodulate the received data.

rxGrid = lteOFDMDemodulate(enb,rxWaveform);

%
% Then, perform channel estimation.

[hest,n0] = lteDLChannelEstimate(enb,cec,rxGrid);

%
% Finally, apply the MMSE equalization.

out = lteEqualizeMMSE(rxGrid,hest,n0);

%
% Show scatter plot of one component carrier.

scatterplot(out(:,1))

% Copyright 2012 The MathWorks, Inc.