📄 ffskdemod.m
字号:
function ffskdemod
clear all;
clc;
close all;
fs1=12000;
fs2=6000;
fid=fopen('ffskdemo.wav');
[x1,n]=fread(fid,48000,'int16');
fclose(fid);
t=1:floor(n/2);
xin=x1(2*t-1);
%subplot(2,1,1);plot(t,xin(t));
s=100;
e=floor(n/2-100);
t=s:e;
x=xin(t);
[b,a]=ellip(2,1,40,2*2000/fs1);
x=filter(b,a,x);
e=floor((e-s)/2);
y=zeros(1,e);
t=1:e;
y(t)=x(2*t-1);
%subplot(2,1,2);plot(t,y(t));
[b,a]=ellip(2,1,40,2*1000/fs2,'high');
y=filter(b,a,y);
t=1:e;
subplot(2,1,1);plot(t,y(t));
d1=0;
d2=0;
d3=0;
for t=1:e
k=round(y(t)*d3/32768);
d3=d2;
d2=d1;
d1=y(t);
y(t)=k;
end
[b,a]=ellip(1,1,40,2*600/fs2);
y=filter(b,a,y);
t=1:e;
x=zeros(1,e);
subplot(2,1,2);plot(t,y(t),t,x(t));
sgstate=0;
s=1;
uplevelcnt=0;
dnlevelcnt=0;
for t=1:e
if y(t)>10
sgstate=1;
else
if y(t)<-10
sgstate=-1;
end
end
if sgstate>0
if dnlevelcnt>0
x(s)=uplevelcnt;
x(s+1)=dnlevelcnt;
uplevelcnt=0;
dnlevelcnt=0;
s=s+2;
end
uplevelcnt=uplevelcnt+1;
else
dnlevelcnt=dnlevelcnt+1;
end
end
x(s)=uplevelcnt;
x(s+1)=dnlevelcnt;
s=s+1;
x(1:s)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -