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

📄 qam_16.m

📁 卫星信道中的调制识别的matlab仿真分析
💻 M
字号:
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信号的时域图形')


⌨️ 快捷键说明

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