yijiangshan
2008-03-13, 18:25
通过读入录有拨电话号码的wav文件,用MATLAB语言编写程序,建立拨号信号的数学模型,应用傅里叶分析的方法,可以把电话号码恢复出来。
求各位大虾帮忙!!!!!!!!!!!:ft:
我用的是DTMF译码,不知道是否与你要求的一样.
function [telnum]=fft256_detDTMF(filename,dataN)
%**********************************************************************
%对波形文件进行256点FFT运算,并进行DTMF译码.
%telnum=fft256_detDTMF('telnum.wav',256);
%the result of telnum is:num
%取整函数:floor(向下取整) ceil (向上取整)
%参数:filename 波形文件名 dataN 数据长度
%*********************************************************************
N=256;
[wave,fs]=wavread(filename);
wav=[];
for k=1:dataN
wav=[wav wave(k)];
end
xf=fft(wav,N);
n=0:N-1;
stem(n*fs/N,abs(xf),'.');
xlabel(' fft frequency(Hz)','fontsize',12,'fontweight','bold');
axf=abs(xf);
max_f=pkpicker(axf,20,4); %求频率向量中最大幅度值
for n=1:length(axf)
if(axf(n)>=max_f(1)) k1=n;break;
end
end
for i=(k1+1):length(axf)
if(axf(i)>=max_f(2)) k2=i;break;
end
end
fl=floor(k1*fs/N); %求频率FL,FH
fh=floor(k2*fs/N);
if fl<=718
fl=718;
elseif fl<=812
fl=812;
elseif fl<=875
fl=875;
else
fl=968;
end
if fh<=1250
fh=1250;
elseif fh<=1375
fh=1375;
else
fh=1500;
end
switch fl %译码选择
case 718
hang=1;
case 812
hang=2;
case 875
hang=3;
case 968
hang=4;
otherwise
;
end
switch fh
case 1250
lie=1;
case 1375
lie=2;
case 1500
lie=3;
otherwise
;
end
switch hang
case 1
switch lie
case 1
num=1;
case 2
num=2;
case 3
num=3;
otherwise
;
end
case 2
switch lie
case 1
num=4;
case 2
num=5;
case 3
num=6;
otherwise
;
end
case 3
switch lie
case 1
num=7;
case 2
num=8;
case 3
num=9;
otherwise
;
end
case 4
switch lie
case 2
num=0;
otherwise
;
end
end
telnum=num;
vBulletin® v3.8.3,版权所有 ©2000-2025,Jelsoft Enterprises Ltd.