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

📄 res_corr.m

📁 基于OFDM的无线宽带系统仿真It contains mainly two parts, i.e. link-level simulator and system-level simulator.
💻 M
字号:
% gives two figures% figure 1 is time domain correlation, x: frame index, y: correlation% figure 2 is frequency domain correlation x: subchannel index, y: correlation% time domain correlation:%   calculate for each UE at each subchannel, then average% frequency domain correlation:%   calculate for each UE at each frame index, then averagefunction [result,fileidx] = res_corr(test_resource_allocation_idx,UE,MIMO,loaddir,result,fileidx,Comm_conf)filename = ['RA',num2str(test_resource_allocation_idx),'_UE',num2str(UE),'_FLA',num2str(Comm_conf.F_LA),'_FPA',num2str(Comm_conf.F_PA),MIMO,'_trms',num2str(Comm_conf.t_rms),'f',num2str(Comm_conf.fd),'_s',num2str(Comm_conf.state),'N',num2str(Comm_conf.N),'subN',num2str(Comm_conf.subN),'_E',num2str(Comm_conf.flg_csi_err),'c',num2str(Comm_conf.flg_offset),'D',num2str(Comm_conf.DELAY),'BO',num2str(Comm_conf.BO_dB),'HPA',num2str(Comm_conf.use_HPA_flg),'_BLER',num2str(Comm_conf.targetFER),'.mat'];load([loaddir,'/',filename],'save_bs_mobID');max_mobID = double(max(save_bs_mobID(:,end)));corr_t = cell(1,max_mobID); corr_f = cell(1,max_mobID);for mobID = 1:max_mobID    if(mod(mobID,50) == 0),        double(mobID) / double(max_mobID) * 100    end    tmp_T = (save_bs_mobID == mobID);    interest_idx1 = find(sum(tmp_T,1)~=0);    tmp_F = (save_bs_mobID(:,interest_idx1) == double(mobID));    interest_idx2 = find(sum(tmp_F,2)~=0);    if isempty(interest_idx1),        corr_t{mobID} = [];        corr_f{mobID} = [];        continue;    end    corre_tmpt = zeros(length(interest_idx2),2*(length(min(interest_idx1):max(interest_idx1)))-1);    corre_tmpf = zeros(2*size(save_bs_mobID,1)-1,length(interest_idx1));    for f = 1:length(interest_idx2)        tmpV = (tmp_T(interest_idx2(f),min(interest_idx1):max(interest_idx1)));        corre_tmpt(f,:) = xcorr(tmpV);    end    corre_tmpf = xcorryy(tmp_T(:,interest_idx1));    corre_t = mean(corre_tmpt,1);    corre_f = mean(corre_tmpf,2);    corr_t{mobID} = corre_t((length(corre_t)+1)/2:end)/max(corre_t((length(corre_t)+1)/2:end));    corr_f{mobID} = corre_f;%((length(corre_f)+1)/2:end)/max(corre_f((length(corre_f)+1)/2:end));endlens_t = zeros(1,max_mobID);lens_f = zeros(1,max_mobID);for k = 1:max_mobID%size(corr_t,2)    lens_t(k) = length(corr_t{k});    lens_f(k) = length(corr_f{k});endcorr_t_all = zeros(max_mobID,max(lens_t));% + 1);corr_f_all = zeros(max_mobID,max(lens_f));% + 1);for k = 1:max_mobID    corr_t_all(k,1:lens_t(k)) = corr_t{k};    corr_f_all(k,1:lens_f(k)) = corr_f{k};endcorr_t_all((lens_t==0),:) = [];corr_f_all((lens_t==0),:) = [];corr_t_av = mean(corr_t_all,1);corr_f_av = mean(corr_f_all,1);colors = {[0.5 0.5 0.5],[0 0 0],[0 0.5 1],[0 0 1],[1 0 0.5],[1 0 0]};lst = {'-','-.','-','-.','-','-.'};RAs = {'RR','PF','MX','PF2'};para.RA = RAs{test_resource_allocation_idx};UEs = [4 10];para.UE = UE;para.ra_ix = test_resource_allocation_idx;if Comm_conf.F_LA == 2 && Comm_conf.F_PA == 2,    para.ra_ix = 4;endif MIMO == 2,    para.ra_ix = 5;endpara.ue_ix = find(UEs == para.UE);para.nuSymbol = 6;para.subN = Comm_conf.subN;para.Tfrm = 5e-4;fileidx = fileidx + 1;%%result.ra_idx(fileidx) = test_resource_allocation_idx;result.LGD{fileidx} = [para.RA,',UE',num2str(para.UE),',F',num2str(Comm_conf.F_LA),'P',num2str(Comm_conf.F_PA),',',MIMO];%%cfigure(1);handleT = plot(corr_t_av/max(corr_t_av));hold on;set(handleT,'Color',colors{fileidx},'LineStyle',lst{fileidx},'LineWidth',2);result.figname{1}=['correlation_time'];xlabel('Frame Index','FontSize',14,'fontname','times','FontWeight','b');ylabel('Time Domain Allocation Correlation','FontSize',14,'fontname','times','FontWeight','b');xlim([1 20]); grid on; grid minor;cfigure(2);handleF = plot(corr_f_av/max(corr_f_av));hold on;set(handleF,'Color',colors{fileidx},'LineStyle',lst{fileidx},'LineWidth',2);result.figname{2}=['correlation_freq'];xlabel('Sub-channel Index','FontSize',14,'fontname','times','FontWeight','b');ylabel('Frequency Domain Allocation Correlation','FontSize',14,'fontname','times','FontWeight','b');xlim([1 Comm_conf.subN]); grid on; grid minor;

⌨️ 快捷键说明

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