📄 bpskm.m
字号:
function [num2,ratio2]=bpskm(msg,a)
fc=16;
fs=64;
%msg=randint(nn,1);
msg=[1 1 0 1 0 1 0 0 1 1 1 0 0 0 1 1]; a=0;
nn=length(msg);
msg1=msg*2-1;
t=0:1/(fs*nn):1-1/(fs*nn);
for j=1:nn
I((j-1)*fs+1:j*fs)=msg1(j);
end
y=cos(pi/4)*(I.*cos(2*pi*fc*t));
y=y+a*randn(1,nn*fs);
figure;
plot(t,y);
axis([0 1 -1.2 1.2]);
I2=y.*cos(2*pi*fc*t);
[b,a]=butter(2,2/fs);
I3=filtfilt(b,a,I2);
figure;
subplot(2,1,1);
plot(t,I2);
hold on;
plot(t,I3,'r-');
subplot(2,1,2);
eyescat(I3,nn,nn*fs,0,fs/2);
N=length(y)/fs;
n=(0.5:1:N-0.5)*fs;
In=(sign(I3(n))+1)/2;
[num2,ratio2]=symerr(msg,In);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -