⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btr_ofdm.m

📁 基于OFDM的无线宽带系统仿真It contains mainly two parts, i.e. link-level simulator and system-level simulator.
💻 M
字号:
%OFDM transiver plus channel
%B and P contains bits number and power for each subcarrier
%ch is the channel matrix, chnums is the No. of channel realizations
%N is the No. of subcarriers
%T_div and R_div are transmitter/receiver diversity branches
%pn is the normalized noise power
%T_trans is the modulated signal (After Alamouti for MISO-Alamouti)
%cp_l is the length of CP
%R_dfs is the received signal, without CP
%H is the freqneucy response of channel impulse response
%
%by Yuanye Wang
%CTIF, Aalborg University
%yywang@kom.aau.dk
%29-06-2006
%Last modification: August 01 CL
%function [R_dfs,fs1_before_PA,SNR_afterPowerAmp,SNR_beforePowerAmp]=BTR_ofdm(h2,N,cp_l,T_trans,snr,T_div,R_div,Nsymbol,flg_offset,fd,BW,sampling_rate,noisePowPerSubC)
function [R_dfs]=BTR_ofdm(h2,N,cp_l,T_trans,snr,T_div,R_div,Nsymbol,flg_offset,fd,BW,sampling_rate,noisePowPerSubC)
%% offset part
%BW = 5e6;
% F_Sampling = BW*sampling_rate;
% T_Sampling = 1/F_Sampling;
% T_Symbol = (N+cp_l)*T_Sampling;
global use_HPA_flg;
T_Sampling = 1/(BW*sampling_rate);
T_Symbol = (N+cp_l)/(BW*sampling_rate);
if flg_offset==1        % Simulation Including Carrier ofset
    t=0:T_Sampling:T_Symbol-T_Sampling;
    offset=exp(-j*2*pi*fd*t)';
else
    offset=1;
end
%%
pn=noisePowPerSubC;%1/10^(snr/10)/N;     %Noise power in each subcarrier
fss = ifft(T_trans,N,1);
fs1=[fss(N-cp_l+1:end,:,:);fss];
fs1_before_PA=fs1;

% sdnr_lin_mean_beforHPA=(mean(sum(abs(fs1(1:N,:)).^2)))/( pn);
% if sdnr_lin_mean_beforHPA>0
%     SNR_beforePowerAmp=10*log10(sdnr_lin_mean_beforHPA); % Calculation of new SNR taking Backoff into account.
% else
%     SNR_beforePowerAmp=nan;
% end
% % PASS THROUGH THE HIGH POWER AMPLIFIER
if use_HPA_flg
fs1_HPA =Rapps_model(fs1,'');%Amplifying the signal with Rapps model
else
    fs1_HPA =fs1;
end

% % transmit side SDNR values
% sdnr_lin_mean=(mean(sum(abs(fs1_HPA(1:N,:)).^2)))/( mean(sum(abs(fs1_HPA-fs1).^2)) +pn);
% if sdnr_lin_mean>0
%     SNR_afterPowerAmp=10*log10(sdnr_lin_mean); % Calculation of new SNR taking Backoff into account.
% else
%     SNR_afterPowerAmp=nan;
% end
% 
% 

fst3 = zeros(N+cp_l,Nsymbol,T_div);
fs3 = zeros(N+cp_l,Nsymbol,R_div);
for rx = 1:R_div
    for tx = 1:T_div
        for k=1:Nsymbol
            fst3(:,k,tx)=filter(h2(:,k,(rx-1)*T_div+tx),1,fs1_HPA(:,k,tx)).*offset;
        end
    end
    fs3(:,:,rx) = sum(fst3,3);
end
% clear i;
noise=randn(size(fs3))+i*randn(size(fs3));
noise=noise/sqrt(pv(noise))*sqrt(pn)/sqrt(N);
splusn=fs3+noise;
rcp=splusn(cp_l+1:end,:,:);
R_dfs=fft(rcp,N,1);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -