• 大小: 1KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: Matlab
  • 标签: ASK  matlab  

资源简介

ASK调制matlab代码,可以帮到你学习案例

资源截图

代码片段和文件信息

clear all
close all
i=10;
j=5000;
t=linspace(010j);%   linspace(x0x1n)其中n代表的是点的数目,即分成n-1等分。步长应当是(x1-x0)/(n-1) 
fc=10;
SNR=10;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%产生基带信号
a=round(rand(1i));%随机序列
plot(rand(1i))
st=t;
for n=1:10
    for m=j/i*(n-1)+1:j/i*n
          if a(n)<1
              st(m)=0;
          else
              st(m)=1;
          end
      end
  end 
figure(1)
subplot(311);
plot(tst);
axis([010-12]);
title(‘基带信号‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%载波
s1=cos(2*pi*fc*t);
subplot(312);
plot(ts1);
axis([0 10 -1.2 1.2]);
title(‘载波信号‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%调制
e_2ask=st.*s1;
subplot(313);
plot(te_2ask);
axis([ 0 10 -2 2]);
title(‘已调信号‘);
awgn_2ask=awgn(e_2askSNR‘measured‘‘dB‘);%%%%%%%%%%%%%%%加入高斯白噪声
figure(2)
subplot(411);
plot(tawgn_2ask);
axis([ 0 10 -2 2]);
title(‘加入噪声的信号‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%相干解调
[B1A1]=butter(1[8/(500/2) 12/(500/2)]);%带通滤波器
awgn_ask1=filter(B1A1awgn_2ask);
at=awgn_ask1.*cos(2*pi*fc*t);
subplot(412);
plot(tat);
axis([ 0 10 -2 2]);
title(‘带通滤波后与和载波同频同相的信号相乘‘);
[BA]=butter(12/(500/2)‘low‘);
at=filter(BAat);
subplot(413);
plot(tat);
title(‘解调后波形‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%抽样判决
at1=zeros(1j);
for m=1:i
    for j=(m-1)*500+1:m*500
        if at(1(m-1)*500+250)+0.5<0.5
            at1(1j)=0;
        else
            at1(1j)=1;
        end
    end
end
subplot(414)
plot(tat1);
axis([010-12]);
title(‘抽样判决后波形‘)
%%%%%%%%%%%%%%%%%%%%%%%%%%%     相干解调后误码率统计
for m=1:10
    for j=(m-1)*500+1:m*500
        if at(1j)+0.5<0.5
            at2(1j)=0;
        else  at2(1j)=1;
        end
    end
end
error=st-at2;
error=abs(error);
errorrate=sum(error)/5000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  过程中各波形频谱
figure(3)
subplot(511)
[fstf]=T2F(tst);
plot(fstf);
ylabel(‘(dB/Hz)‘);
axis([-15 15 -2 6]);
title(‘输入信号频谱‘)
subplot(512)
[fs1f]=T2F(ts1);
plot(fs1f);
ylabel(‘(dB/Hz)‘);
axis([-15 15 -2 6]);
title(‘载波信号频谱‘)
subplot(513)
[fe_2askf]=T2F(te_2ask);
plot(fe_2askf);
ylabel(‘(dB/Hz)‘);
axis([-15 15 -2 6]);
title(‘已调信号频谱‘)
subplot(514)
[fawgn_2askf]=T2F(tawgn_2ask);
plot(fawgn_2askf);
ylabel(‘(dB/Hz)‘);
axis([-15 15 -2 6]);
title(‘加入高斯白噪声后已调信号频谱‘)
subplot(515)
[fat1f]=T2F(tat1);
plot(fat1f);
ylabel(‘(dB/Hz)‘);
axis([-15 15 -2 6]);
title(‘解调之后进行抽样判决后信号频谱‘)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2594  2010-06-10 19:04  ASK.m

评论

共有 条评论