?? psk_2.m
字號(hào):
function y=psk_2(snr_in);
snr=10^(snr_in/10);
x=rand(100,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,l);
for i=1:h,
if x(i)>=0.5
x(i)=1;
else x(i)=0;
end
end
for i=1:h,
switch x(i)
case 1 ,y(i,:)=-cos(2*pi*fc.*t(i,:));
otherwise y(i,:)=cos(2*pi*fc.*t(i,:));
end
end
y0=reshape(y',l*h,1);
power=y0'*y0;
powerzao=power/snr;%以下是產(chǎn)生高斯白噪聲序列
a=sqrt(powerzao/(l*h));
zao=a*randn(l*h,1);
powerzao2=zao'*zao;
y=y0+zao;%加噪以后的信號(hào)
t=reshape(t',l*h,1);
subplot(311);plot(t,y);
grid on
title('BPSK信號(hào)的時(shí)域圖形')
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -