• 大小: 8KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-18
  • 语言: Matlab
  • 标签: matlab  神经网络  

资源简介

利用matlab和神经网络进行信号调制识别的程序,程序很完整,能够进行信号选择并且输出识别率。

资源截图

代码片段和文件信息

clear all;
close all;
echo off;
fc=20000; %载波频率
fs=40000; %采样速率
k=2;
code_size=15*round(k*fs/fc);             %信息码元长度
t0=5.5;                               %信号长度
Ns=256;                              %采样点个数
fd=200;                              %符号速率
ts=1/fs;                               %采样周期
M=64                                %码元个数
ti=1/fd;                               %码元间隔
N=ti/ts
t=[0:ts:t0];
select=menu(‘调制方式‘‘2ASK‘‘2FSK‘‘2PSK‘‘4ASK‘‘4FSK‘‘4PSK‘);
switch select
case 1                                % 2ASK signal
x=randint(1M);
m=sin(2*pi*fc*t);
y=ones(1M*N);
for i=1:M
    for j=1:N
       y((i-1)*N+j)=x(i)*m(j);
    end
end
T=zeros(650);
T(11:50)=1; 
case 2                                 %2FSK signal
x=randint(1M);  
m1=sin(2*pi*fc*t);
m2=sin(2*pi*2*fc*t);
y=zeros(1M*N);
for i=1:M
   if x(i)==1;
    for j=1:N;
        y((i-1)*N+j)=x(i)*m1(j);
    end
   elseif  x(i)==0;
     for j=1:N;
       y((i-1)*N+j)=(1-x(i))*m2(j);
     end 
  end
end
T=zeros(650);
T(21:50)=1; 
case 3                                 %2PSK signal
x=randint(1M); 
m1=sin(2*pi*fc*t);
m2=sin(2*pi*fc*t+pi);
y=zeros(1M*N);
for i=1:M
   if x(i)==1;
    for j=1:N;
        y((i-1)*N+j)=x(i)*m1(j);
   end
   elseif  x(i)==0;
     for j=1:N;
       y((i-1)*N+j)=(1-x(i))*m2(j);
     end 
   end
end
T=zeros(650);
T(31:50)=1;
case 4                                 % 4ASK signal
x=randint(1M4);
m=sin(2*pi*fc*t);
y=ones(1M*N);
for i=1:M
    if x(i)==0;
    for j=1:N
       y((i-1)*N+j)=x(i)*m(j);
    end
elseif x(i)==1;
    for j=1:N
       y((i-1)*N+j)=x(i)*m(j);
    end
elseif x(i)==2;
    for j=1:N
       y((i-1)*N+j)=x(i)*m(j);
    end
elseif x(i)==3;
    for j=1:N
       y((i-1)*N+j)=x(i)*m(j);
    end  
  end  
end
T=zeros(650);
T(41:50)=1; 
case 5                                 % 4FSK signal
x=randint(1M4);
m1=sin(2*pi*fc*t);
m2=sin(2*pi*2*fc*t);
m3=sin(2*pi*3*fc*t);
m4=sin(2*pi*4*fc*t);
y=zeros(1M*N);
for i=1:M
    if x(i)==0;
    for j=1:N
       y((i-1)*N+j)=(1-x(i))*m1(j);
    end
elseif x(i)==1;
    for j=1:N
       y((i-1)*N+j)=x(i)*m2(j);
    end
elseif x(i)==2;
    for j=1:N
       y((i-1)*N+j)=(x(i)-1)*m3(j);
    end
elseif x(i)==3;
    for j=1:N
       y((i-1)*N+j)=(x(i)-2)*m4(j);
    end  
  end  
end
plot(y)
T=zeros(650);
T(51:50)=1;
case 6                                     %4PSK signal
x=randint(1M4);
m1=sin(2*pi*fc*t);
m2=sin(2*pi*fc*t+pi/2);
m3=sin(2*pi*fc*t+pi);
m4=sin(2*pi*fc*t+3*pi/2);
y=zeros(1M*N);
for i=1:M
    if x(i)==0;
    for j=1:N
       y((i-1)*N+j)=(1-x(i))*m1(j);
    end
elseif x(i)==1;
    for j=1:N
       y((i-1)*N+j)=x(i)*m2(j);
    end
elseif x(i)==2;
    for j=1:N
       y((i-1)*N+j)=(x(i)-1)*m3(j);
    end
elseif x(i)==3;
    for j=1:N
       y((i-1)*N+j)=(x(i)-2)*m4(j);
    end  
  end  
end
T=zeros(650);
T(61:50)=1;
end
SNR=5;                          

评论

共有 条评论