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

📄 test_sc1.asv

📁 基于小波变换的调制识别方法.里面包含如下内容:QAM、PSK、FSK、AM和OFDM信号源生成程序
💻 ASV
字号:

%%%%%%%%FSK
%clear;
%clc;
x_time = 0.01;%仿真时间
for m=1:20 %试验次数
for snr=1:26
 r=randint(1,1,1000);%产生随机数
sim('test_source1');%启动仿真数据源
s=snr-1;%设置信噪比
x =hilbert(FSK(1:4000));%希尔伯特变换
data1=awgn(x,snr,'measured');%加高斯白噪声
data=data1/sqrt(sum(real(data1).*real(data1)+imag(data1).*imag(data1))/length(data1));%功率归一化处理
dataa=data./abs(data);%幅度归一化
scal = 4;%小波变换的尺度因子
coef1= cwt(data,scal,'haar');
coef2= cwt(dataa,scal,'haar');
a=abs(coef1(1:4000));b=abs(coef2(1:4000));
%subplot(3,1,1);
%plot(abs(coef1(10:8000)));
%subplot(3,1,2);
%plot(abs(coef2(10:8000)));
c=medfilt1(a,20);%中值滤波 
d=medfilt1(b,20);

p1f(m,snr)=var(c);%计算方差
p2f(m,snr)=var(d);
end
end
%i=0:30
%%figure(2)
%plot(i,p1,'*',i,p2,'p');
%%%%%%%%%PSK

for m=1:20
for snr=1:26
 r=randint(1,1,1000);
sim('test_source1');
s=snr-1;
x =hilbert(PSK(1:4000));
data1=awgn(x,snr,'measured');
data =data1/sqrt(sum(real(data1).*real(data1)+imag(data1).*imag(data1))/length(data1));
dataa=data./abs(data);
scal = 4;
coef1= cwt(data,scal,'haar');
coef2= cwt(dataa,scal,'haar');
a=abs(coef1(1:4000));b=abs(coef2(1:4000));
%subplot(3,1,1);
%plot(abs(coef1(10:8000)));
%subplot(3,1,2);
%plot(abs(coef2(10:8000)));
c=medfilt1(a,20);d=medfilt1(b,20);

p1p(m,snr)=var(c);
p2p(m,snr)=var(d);
end
end
%%%%%%%%%QAM
for m=1:20
for snr=1:26
 r=randint(1,1,1000);
sim('test_source1');
s=snr-1;
x =hilbert(QAM(1:4000));
data1=awgn(x,snr,'measured');
data = data1/sqrt(sum(real(data1).*real(data1)+imag(data1).*imag(data1))/length(data1));
dataa=data./abs(data);
scal = 4;
coef1= cwt(data,scal,'haar');
coef2= cwt(dataa,scal,'haar');
a=abs(coef1(1:4000));b=abs(coef2(1:4000));
%subplot(3,1,1);
%plot(abs(coef1(10:8000)));
%subplot(3,1,2);
%plot(abs(coef2(10:8000)));
c=medfilt1(a,20);d=medfilt1(b,20);

p1a(m,snr)=var(c);
p2a(m,snr)=var(d);
end
end
%subplot(3,1,1);plot(a3);
%ylabel('|HWT|');
%title('|HWT| of QAM signal with amplitude normalization');
%subplot(3,1,2);plot(a2);
%ylabel('|HWT|');
%title('|HWT| of PSK signal with amplitude normalization');
%subplot(3,1,3);plot(a1);
%ylabel('|HWT|');axis([0 8000 0 2 ]);
%title('|HWT| of FSK signal with amplitude normalization');
%plot(bfsk,'-p');
%xlabel('SNR(dB)');
%ylabel('VAR');

%legend('qam','bpsk','bfsk');
%hold on
%a=mean(bfsk),b=mean(bpsk),c=mean(qam);
%i=0:30;plot(i,a,'--',i,b,'-p',i,c,'-o');xlabel('SNR(dB)');ylabel('VAR');legend('bfsk','bpsk','qam');grid on
%求平均方差值
a1=sum(p1a)/20;a2=sum(p1f)/20;a3=sum(p1p)/20;
b1=sum(p2a)/20;b2=sum(p2f)/20;b3=sum(p2p)/20;
%绘制不同信噪比
i=0:25;
subplot(2,1,1);plot(i,a1,'-*b',i,a2,'--pr',i,a3,'-.ok');legend('QAM','FSK','PSK');xlabel('SNR(dB)');ylabel('VAR');title('without amplitude normalization') ;grid on;
subplot(2,1,2);plot(i,b1,'-*b',i,b2,'--pr',i,b3,'-.ok');legend('QAM','FSK','PSK');xlabel('SNR(dB)');ylabel('VAR');title('with amplitude normalization') ; grid on;
th1=a2(1)/2;th2=(b1(1)+b2(1))/2;%设置门限
%求正确识别率
s1=p1a>th1;s2=p2a<th2;
t1=p1p<th1;t2=p2p<th2;
r1=p1f>th1;r2=p2f>th2;
aa1=s1+s2;aaa1=aa1-1;
aa2=t1+t2;aaa2=aa2-1;
aa3=r1+r2;aaa3=aa3-1;
answer1=sum(aaa1)/2;
answer2=sum(aaa2)/2;
answer3=sum(aaa3)/2;

figure(2);
subplot(2,2,1);
plot(i,answer1,'-*b',i,answer3,'--pr',i,answer2,'-.ok');
legend('QAM','FSK','PSK');xlabel('SNR(dB)');ylabel('the probability of detection');grid on;

⌨️ 快捷键说明

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