📄 bfsk.m
字号:
%***************modulation*********************
D=[1 0 1 1 0 0 1 0];
N=length(D);%基带信号符号数目
t=0:0.01:7.99;
d0=D;d1=~D;%d1是d0的反码
x=ones(1,100);%100个1
D1=[];D0=[];%造两个空矩阵
for k=1:N,
D1=[D1,d1(k)*x];
D0=[D0,d0(k)*x];
end%开关信号
f1=0.5;f2=1.5;%两个载波频率
c1=cos(2*pi*f1*t);
c2=cos(2*pi*f2*t);
m=D0.*c1+D1.*c2;%2fsk的表达式
%***************demodulation******************
msg1=m.*c1;
msg2=m.*c2;
msg=msg1-msg2;
M=length(msg);
for i=1:M,
if msg(i)>0;
demo(i)=1;
else demo(i)=0;
end
end
%********************drawing*******************
subplot(2,1,1);plot(m);grid ;title('2FSK modulation');axis([0,800,-2,2]);
subplot(2,1,2);plot(demo);grid ;title('2FSK demodulation');axis([0,800,-2,2]);
xlabel('1 0 1 1 0 0 1 0');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -