figure(1) subplot(3,1,1) plot(q1) title('数字8的双音频信号的离散信号') hold on subplot(3,1,2) plot(q3) title('理想电话拨号音信号') hold on subplot(3,1,3) plot(q4) title('理想的拨号音上叠加一个50Hz的工频干扰信号') hold on
figure(2) subplot(6,1,1) plot(q510) title('叠加信噪比分别为10dB白噪声信号的拨号音') hold on subplot(6,1,2) plot(q55) title('叠加信噪比分别为5dB白噪声信号的拨号音') hold on subplot(6,1,3) plot(q53) title('叠加信噪比分别为3dB白噪声信号的拨号音') hold on subplot(6,1,4) plot(q52) title('叠加信噪比分别为2dB白噪声信号的拨号音') hold on subplot(6,1,5) plot(q51) title('叠加信噪比分别为1dB白噪声信号的拨号音') hold on subplot(6,1,6) plot(q50) title('叠加信噪比分别为0dB白噪声信号的拨号音') hold on
function[h, l] = mfind(x) if (x == '1') h = 697;l = 1209; elseif x == '2' h = 697;l = 1336; elseif x == '3' h = 697;l = 1477; elseif x == '4' h = 770;l = 1209; elseif x == '5' h = 770;l = 1336; elseif x == '6' h = 770;l = 1477; elseif x == '7' h = 852;l = 1209; elseif (x == '8') h = 852;l = 1336; elseif x == '9' h = 852;l = 1477; elseif x == '0' h = 941;l = 1336; elseif x == '#' h = 941;l = 1209; elseif x == '*' h = 941;l = 1477; elseif x == 'A' h = 697;l = 1633; elseif x == 'B' h = 770;l = 1633; elseif x == 'C' h = 852;l = 1633; elseif x == 'D' h = 941;l = 1633; end end
function[S] = liushibie(x) % clear m=length(x); % global flag l=1; b=0; sum=0; fori=1:1:100 sum=sum+x(i)^2; end s(1)=sum/100; fori=2:1:(m-99) s(i)=(100*s(i-1)-x(i-1)^2+x(i+99)^2)/100; end if s(1)<0.65 h=0; else h=1; end fori=1:1:(m-99) if s(i)<0.65 h=0; end if (h==0)&&(s(i)>0.8)&&(s(i)>=s(i-1)&&s(i)>=s(i+1)) S(l)=Sampling(x(i+100:1:i+304)); %富裕100个点取205个点到304,即100-304共205个点 if S(l)=='E'||l>8 S='已不能识别'; % flag=1; break end l=l+1; h=1; end end % if strcmp(s(1),'E') % S='已不能识别';
DFT函数
1 2 3 4 5 6 7
function[v] = DFT(k,y) v=0; fori=0:1:204 v=v+y(i+1)*exp(-j*2*pi/205*k*i); end v=abs(v); end