function y=QAM_16(snr_in)
snr=10^(snr_in/10);
x=rand(200,1);
h=length(x);
fc=10000;fs=100000;
ts=10/fc;t=0:1/fs:ts*h-1/fs;l=length(t)/h;
t=reshape(t',l,h);t=t';
y=zeros(h/4,l);
for i=1:h,
if x(i)>=0.5
x(i)=1;
else x(i)=0;
end
end
j=1;
for i=1:2:h,
z(j)=2*x(i)+x(i+1);
j=j+1;
end
for i=1:h/4,
I(i)=z(2*i-1);
Q(i)=z(2*i);
end
for i=1:h/4,
if I(i)==0&Q(i)==0
y(i,:)=-3*cos(2*pi*fc.*t(i,:))+3*sin(2*pi*fc.*t(i,:));end
if I(i)==1&Q(i)==0
y(i,:)=-1*cos(2*pi*fc.*t(i,:))+3*sin(2*pi*fc.*t(i,:));end
if I(i)==2&Q(i)==0
y(i,:)=1*cos(2*pi*fc.*t(i,:))+3*sin(2*pi*fc.*t(i,:)); end
if I(i)==3&Q(i)==0
y(i,:)=3*cos(2*pi*fc.*t(i,:))+3*sin(2*pi*fc.*t(i,:));end
if I(i)==0&Q(i)==1
y(i,:)=-3*cos(2*pi*fc.*t(i,:))+1*sin(2*pi*fc.*t(i,:));end
if I(i)==1&Q(i)==1
y(i,:)=-1*cos(2*pi*fc.*t(i,:))+1*sin(2*pi*fc.*t(i,:));end
if I(i)==2&Q(i)==1
y(i,:)=1*cos(2*pi*fc.*t(i,:))+1*sin(2*pi*fc.*t(i,:));end
if I(i)==3&Q(i)==1
y(i,:)=3*cos(2*pi*fc.*t(i,:))+1*sin(2*pi*fc.*t(i,:));end
if I(i)==0&Q(i)==2
y(i,:)=-1*cos(2*pi*fc.*t(i,:))-1*sin(2*pi*fc.*t(i,:));end
if I(i)==1&Q(i)==2
y(i,:)=-1*cos(2*pi*fc.*t(i,:))-1*sin(2*pi*fc.*t(i,:));end
if I(i)==2&Q(i)==2
y(i,:)=1*cos(2*pi*fc.*t(i,:))-1*sin(2*pi*fc.*t(i,:));end
if I(i)==3&Q(i)==2
y(i,:)=3*cos(2*pi*fc.*t(i,:))-1*sin(2*pi*fc.*t(i,:));end
if I(i)==0&Q(i)==3
y(i,:)=-3*cos(2*pi*fc.*t(i,:))-3*sin(2*pi*fc.*t(i,:));end
if I(i)==1&Q(i)==3
y(i,:)=-1*cos(2*pi*fc.*t(i,:))-3*sin(2*pi*fc.*t(i,:));end
if I(i)==2&Q(i)==3 %#ok<AND2>
y(i,:)=1*cos(2*pi*fc.*t(i,:))-3*sin(2*pi*fc.*t(i,:));end
if I(i)==3&Q(i)==3
y(i,:)=3*cos(2*pi*fc.*t(i,:))-3*sin(2*pi*fc.*t(i,:));end
end
y0=reshape(y',l*h/4,1);
power=y0'*y0;
powerzao=power/snr;%以下是产生高斯白噪声序列
a=sqrt(powerzao/(l*h/4));
zao=a*randn(l*h/4,1);
powerzao2=zao'*zao;
y=y0+zao;%加噪以后的信号
t=0:1/fs:ts*h/4-1/fs;
t=reshape(t',l*h/4,1);
subplot(311);plot(t,y);
grid on
title('16QAM信号的时域图形')
调制方式的matlab仿真实现
需积分: 10 177 浏览量
2008-12-23
16:29:30
上传
评论 1
收藏 5KB RAR 举报
luopan_ren
- 粉丝: 0
- 资源: 3
最新资源
- 安卓Android图书馆座位占座app设计可导入Studio源码案例设计.zip
- 安卓Android汽车票售票订票app设计可导入Studio源码案例设计.zip
- 安卓android高校开放式实验室管理app可导入Studio源码案例设计.zip
- [咒术回战][16][京都姐妹校交流会-团体战②-][中文][1080P].mp4
- 安卓Android车辆运输信息管理App可升级Studio源码案例设计.zip
- Android Studio移动应用开发.zip
- [咒术回战][15][京都姐妹校交流会-团体战①-][中文][1080P].mp4
- android studio-GIT.zip
- [咒术回战][14][京都姐妹校交流会-团体战⓪-][中文][1080P].mp4
- [咒术回战][13][明天见][中文][1080P].mp4
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈