www.gusucode.com > LTE_TX_PDSCH > LTE_TX_OFDM_assembly.m
%% OFDM symbol assembly with Primary and Secondary sync signal function BS_output = LTE_TX_OFDM_assembly(LTE_params, precode_y, subframe_corr,... RefSym, RefMapping, total_no_refsym, NoData_indices,... tx_symbols, SyncUsedElements, y_tx_assembled) RB_indices = 1:2*LTE_params.Nrb; % two slots with six RB's in each %% OFDM symbol assembly if(subframe_corr == 1 || subframe_corr == 6) rb_tx_symbols = LTE_params.Nsc*LTE_params.Ns - total_no_refsym... - SyncUsedElements(:); index = 0; for ii = 1:length(RB_indices) if(RB_indices(ii) > LTE_params.Nrb) y_tx_assembled_temp = zeros(LTE_params.Nsc,LTE_params.Ns); y_tx_assembled_temp(~NoData_indices(1:LTE_params.Nsc,1:LTE_params.Ns)) = ... precode_y(1,index+1:index+rb_tx_symbols(ii)).'; y_tx_assembled((RB_indices(ii)-LTE_params.Nrb-1)... *LTE_params.Nsc+1:(RB_indices(ii)-LTE_params.Nrb)... *LTE_params.Nsc,LTE_params.Ns+1:end,1) = y_tx_assembled_temp; else y_tx_assembled_temp = zeros(LTE_params.Nsc,LTE_params.Ns); y_tx_assembled_temp(~(NoData_indices(1:LTE_params.Nsc,1:LTE_params.Ns)... + PrimMapping((RB_indices(ii)-1)*LTE_params.Nsc+1:RB_indices(ii)*LTE_params.Nsc,1:LTE_params.Ns)... + SecMapping((RB_indices(ii)-1)*LTE_params.Nsc+1:RB_indices(ii)*LTE_params.Nsc,1:LTE_params.Ns))) ... = precode_y(1,index+1:index+rb_tx_symbols(ii)).'; y_tx_assembled((RB_indices(ii)-1)*LTE_params.Nsc+1:RB_indices(ii)*LTE_params.Nsc,1:LTE_params.Ns,1) ... = y_tx_assembled_temp; end index = index + rb_tx_symbols(ii); end else tx_symbols(:,:,:) = reshape(precode_y, [LTE_params.Nsc*LTE_params.Ns - ... sum(sum(NoData_indices(1:LTE_params.Nsc,1:LTE_params.Ns)))], LTE_params.Nrb, 2); end %% adding primary sync,secondary sync and reference information if(subframe_corr == 1 || subframe_corr == 6) y_tx_assembled_temp = y_tx_assembled(:,:,1); y_tx_assembled_temp(PrimMapping) = PrimSync; y_tx_assembled_temp(SecMapping) = SecSync; y_tx_assembled(:,:,1) = y_tx_assembled_temp; else y_tx_assembled_temp = zeros(LTE_params.Nsc,LTE_params.Ns); for ii = 1:LTE_params.Nrb y_tx_assembled_temp(~NoData_indices(1:LTE_params.Nsc,1:LTE_params.Ns)) = tx_symbols(:,ii,1); y_tx_assembled((ii-1)*LTE_params.Nsc+1:ii*LTE_params.Nsc,1:LTE_params.Ns,1) = y_tx_assembled_temp; y_tx_assembled_temp(~NoData_indices(1:LTE_params.Nsc,1:LTE_params.Ns)) = tx_symbols(:,ii,2); y_tx_assembled((ii-1)*LTE_params.Nsc+1:ii*LTE_params.Nsc,LTE_params.Ns+1:end,1) = y_tx_assembled_temp; end end y_tx_assembled(RefMapping) = RefSym(RefSym~=0); %% Zero padding, IFFT, add CP % insert zero DC carrier y_tx_assembled_padded = [y_tx_assembled(1:LTE_params.Ntot/2,:,1); ... zeros(1,LTE_params.Nsub); y_tx_assembled(LTE_params.Ntot/2+1:end,:,1)]; y_tx_assembled_padded = padarray(y_tx_assembled_padded,LTE_params.Nfft-LTE_params.Ntot-1,'post'); y_tx_assembled_shifted = circshift(y_tx_assembled_padded,-LTE_params.Ntot/2); y_tx_assembled_ifft = sqrt(LTE_params.Nfft)*sqrt(LTE_params.Nfft/LTE_params.Ntot)... *ifft(y_tx_assembled_shifted); if(length(LTE_params.Tg)==2) BS_output(:,1) = [ y_tx_assembled_ifft(LTE_params.Index_TxCyclicPrefix{1},1);... reshape(y_tx_assembled_ifft(LTE_params.Index_TxCyclicPrefix{2},2:LTE_params.Ns),[],1);... y_tx_assembled_ifft(LTE_params.Index_TxCyclicPrefix{1},LTE_params.Ns+1);... reshape(y_tx_assembled_ifft(LTE_params.Index_TxCyclicPrefix{2},LTE_params.Ns+2:end),[],1) ]; else BS_output(:,1) = reshape(y_tx_assembled_ifft(LTE_params.Index_TxCyclicPrefix,:),[],1); end