资源简介
此程序,是OQPSK的仿真程序,包括,正交调制的输出波形,功率谱分析,及误码率分析,解调采用正交解调方式
代码片段和文件信息
% MATLAB script for System Simulation Homework
close all;
clear all;
% Carrier frequency for modulation and
% demodulation
Fc =5e6;
%
% QPSK transmitter
%
data=5000;% Input binary data of 5MHz
rand_data =randn(1data);
for i=1:data
if rand_data(i)>=0.5
input(i)=1;
else
input(i)=0;
end
end
%Series to Parallel
for i=1:data
if rem(i2)==1
if input(i)==1
I(i)=1;
I(i+1)=1;
else
I(i)=-1;
I(i+1)=-1;
end
else
if input(i)==1
Q(i-1)=1;
Q(i)=1;
else
Q(i-1)=-1;
Q(i)=-1;
end
end
end
Q=[0Q];
% Zero insertion
zero=5; % Sampling rate is 25MHz
for i=1:zero*data
if rem(izero)==1
Izero(i)=I(fix((i-1)/zero)+1);
Qzero(i)=Q(fix((i-1)/zero)+1);
else
Izero(i)=0;
Qzero(i)=0;
end
end
%Pulse shaping filter
NT =50;
N=2*zero*NT;
Fs=25e6;
rf=0.5;
psf=rcosfir(rfNTzeroFs‘sqrt‘);
Ipulse= conv(Izeropsf);
Qpulse= conv(Qzeropsf);
%Modulation
for i=1:zero*data+N
t(i)=(i-1)/(Fc*zero);
Imod(i)=Ipulse(i).*cos(2*pi*Fc*t(i));
Qmod(i)=Qpulse(i).*(-1)*sin(2*pi*Fc*t(i));
end
sum=Imod+Qmod;
plot(tsum);
axis([0.000040 0.000045 -1.5 1.5])
K=1024;
SUM=fft(sumK);
Pxx=abs(SUM).^2/K;
index=0:K-1;
index=index/K*2*pi;
figure(2)
plot(indexPxx)
set(gca‘XTickLabel‘{‘0‘‘pi/4‘‘pi/2‘‘3pi/4‘‘pi‘‘5pi/4‘‘3pi/2‘‘7pi/4‘‘2pi‘})
% Create AWGN complex noise
EbNodBVals=0:2:10; %unit=dB :the power of noise
for SNR=1:length(EbNodBVals)
EbNo=10.^(EbNodBVals(SNR)./10);
EsNo=EbNo;
Es=2;
- 上一篇:gps数据最小二乘拟合分析
- 下一篇:GMSK调制与解调算法研究毕业论文
评论
共有 条评论