clc
close all
clear all
% Basic Carrier Aggregation for simple OFDM transmit chain
%OFDM 2048 point
%The available bandwidth is 8 MHz
%Input Parameters-1
Tu=224e-6; %useful OFDM symbol period
T=Tu/2048; %baseband elementary period
G=0; %choice of 1/4, 1/8, 1/16, and 1/32
delta=G*Tu; %guard band duration
Ts=delta+Tu; %total OFDM symbol period
Kmax=1705; %number of subcarriers
Kmin=0;
FS=4096; %IFFT/FFT length
q=10; %carrier period to elementary period ratio
fc=q*1/T; %carrier frequency
Rs=4*fc; %simulation period
t=0:1/Rs:Tu;
%Data generator-1 (A)
M=Kmax+1;
rand('state',0);
a=-1+2*round(rand(M,1)).'+i*(-1+2*round(rand(M,1))).';
A=length(a);
info=zeros(FS,1);
info(1:(A/2)) = [ a(1:(A/2)).']; %Zero padding
info((FS-((A/2)-1)):FS) = [ a(((A/2)+1):A).'];
%Subcarriers generation (B)
carriers=FS.*ifft(info,FS);
tt=0:T/2:Tu;
figure(1);
subplot(211);
stem(tt(1:20),real(carriers(1:20)));
subplot(212);
stem(tt(1:20),imag(carriers(1:20)));
figure(2);
f=(2/T)*(1:(FS))/(FS);
subplot(211);
plot(f,abs(fft(carriers,FS))/FS);
subplot(212);
pwelch(carriers,[],[],[],2/T);
% D/A simulation-1(A)
L = length(carriers);
chips = [ carriers.';zeros((2*q)-1,L)];
p=1/Rs:1/Rs:T/2;
g=ones(length(p),1); %pulse shape
figure(3);
stem(p,g);
dummy=conv(g,chips(:));
u=[dummy(1:length(t))]; % (C)
figure(4);
subplot(211);
plot(t(1:400),real(u(1:400)));
subplot(212);
plot(t(1:400),imag(u(1:400)));
figure(5);
ff=(Rs)*(1:(q*FS))/(q*FS);
subplot(211);
plot(ff,abs(fft(u,q*FS))/FS);
subplot(212);
pwelch(u,[],[],[],Rs);
[b,a] = butter(13,1/20); %reconstruction filter
[H,F] = freqz(b,a,FS,Rs);
%[H,F] = FREQZ(b,a,FS,Rs);
figure(6);
plot(F,20*log10(abs(H)));
uoft = filter(b,a,u); %baseband signal (D)
figure(7);
subplot(211);
plot(t(80:480),real(uoft(80:480)));
subplot(212);
plot(t(80:480),imag(uoft(80:480)));
figure(8);
subplot(211);
plot(ff,abs(fft(uoft,q*FS))/FS);
subplot(212);
pwelch(uoft,[],[],[],Rs);
%Upconverter-1(A) to 91MHz
s_tilde=(uoft.').*exp(1i*2*pi*fc*t);
s=real(s_tilde); %passband signal (E)
figure(9);
plot(t(80:480),s(80:480));
figure(10);
subplot(211);
%plot(ff,abs(fft(((real(uoft).').*cos(2*pi*fc*t)),q*FS))/FS);
%plot(ff,abs(fft(((imag(uoft).').*sin(2*pi*fc*t)),q*FS))/FS);
plot(ff,abs(fft(s,q*FS))/FS);
subplot(212);
%hold on;
%pwelch(((real(uoft).').*cos(2*pi*fc*t)),[],[],[],Rs);
%pwelch(((imag(uoft).').*sin(2*pi*fc*t)),[],[],[],Rs);
pwelch(s,[],[],[],Rs);
% Input parameters-2(B)
Tu1=200e-6; %useful OFDM symbol period
T1=Tu1/2048; %baseband elementary period
G1=0; %choice of 1/4, 1/8, 1/16, and 1/32
delta1=G1*Tu1; %guard band duration
Ts1=delta1+Tu1; %total OFDM symbol period
Kmax1=1705; %number of subcarriers
Kmin1=0;
FS1=4096; %IFFT/FFT length
q1=10; %carrier period to elementary period ratio
fc1=q1*1/T1; %carrier frequency
Rs1=4*fc1; %simulation period
t1=0:1/Rs1:Tu1;
%Data generator-2 (B)
M1=Kmax1+1;
rand('state',0);
a1=-1+2*round(rand(M1,1)).'+i*(-1+2*round(rand(M1,1))).';
A1=length(a1);
info=zeros(FS1,1);
info(1:(A1/2)) = [ a1(1:(A1/2)).']; %Zero padding
info((FS1-((A1/2)-1)):FS1) = [ a1(((A1/2)+1):A1).'];
%Subcarriers generation (B)
carriers1=FS1.*ifft(info,FS1);
tt1=0:T1/2:Tu1;
figure(11);
subplot(211);
stem(tt1(1:20),real(carriers1(1:20)));
subplot(212);
stem(tt1(1:20),imag(carriers1(1:20)));
figure(12);
f1=(2/T1)*(1:(FS1))/(FS1);
subplot(211);
plot(f1,abs(fft(carriers1,FS1))/FS1);
subplot(212);
pwelch(carriers1,[],[],[],2/T1);
% D/A simulation-2 (B)
L1 = length(carriers1);
chips1 = [ carriers1.';zeros((2*q1)-1,L1)];
p1=1/Rs1:1/Rs1:T1/2;
g1=ones(length(p1),1); %pulse shape
figure(13);
stem(p1,g1);
dummy1=conv(g1,chips(:));
u1=[dummy1(1:length(t1))]; % (C)
figure(14);
subplot(211);
plot(t1(1:400),real(u1(1:400)));
subplot(212);
plot(t1(1:400),imag(u1(1:400)));
figure(15);
ff1=(Rs1)*(1:(q1*FS1))/(q*FS1);
subplot(211);
plot(ff1,abs(fft(u1,q1*FS1))/FS1);
subplot(212);
pwelch(u1,[],[],[],Rs1);
[b1,a1] = butter(13,1/20); %reconstruction filter
[H1,F1] = freqz(b1,a1,FS1,Rs1);
%[H,F] = FREQZ(b,a,FS,Rs);
figure(16);
plot(F1,20*log10(abs(H1)));
uoft1 = filter(b1,a1,u1); %baseband signal (D)
figure(17);
subplot(211);
plot(t1(80:480),real(uoft1(80:480)));
subplot(212);
plot(t1(80:480),imag(uoft1(80:480)));
figure(18);
subplot(211);
plot(ff1,abs(fft(uoft1,q1*FS1))/FS1);
subplot(212);
pwelch(uoft1,[],[],[],Rs1);
%Upconverter-2 (B) to about 110 MHz
s_tilde1=(uoft1.').*exp(1i*2*pi*fc1*t1);
s1=real(s_tilde1); %passband signal (E)
figure(19);
plot(t1(80:480),s1(80:480));
figure(20);
subplot(211);
%plot(ff,abs(fft(((real(uoft).').*cos(2*pi*fc*t)),q*FS))/FS);
%plot(ff,abs(fft(((imag(uoft).').*sin(2*pi*fc*t)),q*FS))/FS);
%hold on
plot(ff1,abs(fft(s1,q1*FS1))/FS1);
subplot(212);
%pwelch(((real(uoft).').*cos(2*pi*fc*t)),[],[],[],Rs);
%pwelch(((imag(uoft).').*sin(2*pi*fc*t)),[],[],[],Rs);
pwelch(s1,[],[],[],Rs1);
figure(21);
pwelch(s,[],[],[],Rs)+pwelch(s1,[],[],[],Rs1);
5G载波聚合的matlab仿真-源码
版权申诉
58 浏览量
2021-10-01
23:57:34
上传
评论
收藏 2KB ZIP 举报
mYlEaVeiSmVp
- 粉丝: 1909
- 资源: 19万+
最新资源
- IMG_0694.GIF
- 基于图像的三维模型重建C++源代码+文档说明(高分课程设计)
- 基于聚焦法的工件立体测量方案,根据数据进行三维重建 使用HALCON处理图像,MATLAB拟合数据+源代码+数据集+效果图
- 锄战三国村 修改:货币使用不减 v1.10(2) 原创 (中文).apk
- 基于python实现的单目双目视觉三维重建+源代码+图像图片(高分课程设计)
- 基于C+++OPENCV的全景图像拼接源码(课程设计)
- 基于Python+OpenCV对多张图片进行全景图像拼接,消除鬼影,消除裂缝+源代码+文档说明+界面截图(高分课程设计)
- 基于C++实现的全景图像拼接源码(课程设计)
- 基于SIFT特征点提取和RASIC算法实现全景图像拼接python源码+文档说明+界面截图+详细注释(95分以上课程大作业)
- 基于matlab实现眼部判别的疲劳检测系统+源代码+全部数据+文档说明+详细注释+使用说明+截图(高分课程设计)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈