欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3816|回復: 0
收起左側

MATLAB數字濾波器程序 Hamming窗帶通濾波器

[復制鏈接]
ID:679278 發表于 2020-1-2 00:48 | 顯示全部樓層 |閱讀模式

Hamming窗帶通濾波器

%Hamming窗帶通濾波器的設計

fp1=200;fc1=100;

fpu=8000;fcu=10000;

wlp=2*pi*fp1/FS;wls=2*pi*fc1/FS;

wup=2*pi*fpu/FS;wus=2*pi*fcu/FS;

Bt=wlp-wls;            

N0=ceil(6.6*pi/Bt);

N=N0+mod(N0+1,2);

wc=[(wls+wlp)/2/pi,(wus+wup)/2/pi];   

hn=fir1(N-1,wc,hamming(N));

[h1,w1] = freqz(hn,1,512,FS);

figure(4);

subplot(2,1,1);plot(hn);axis ([700 900 -0.5 1]);xlabel('n');ylabel('幅度');title('hamming窗帶通時域圖');

subplot(2,1,2);plot(w1,abs(h1));title('hamming窗帶通頻譜圖');axis tight;xlabel('f/Hz');ylabel('耗損(dB)');

pause(1);

%對濾波后的信號進行分析變換

X=conv(hn,x);

n2=length(X);      

n2=2^nextpow2(n2);

f=FS*(0:n2/2-1)/n2;  

figure(5);subplot(2,1,1);plot(X);title('濾波后的信號時域圖');axis tight;xlabel('f/Hz');ylabel('幅度');

X1=fft(X,n2);subplot(2,1,2);plot(f,abs(X1(1:n2/2))); axis tight;xlabel('f/Hz');ylabel('幅度');title('濾波后的信號頻譜');

sound(X,FS);

圖1  語音信號

圖2  加噪信號

圖3  濾波信號

Hamming窗帶通濾波器程序


  1. %hamming帶通

  2. %產生語音信號

  3. clc;

  4. Fs=48000;

  5. [x,FS]=audioread('C:\Users\SDHH\Documents\錄音\luyin.m4a');

  6. x=x(:,1);

  7. sound(x,FS);

  8. %頻譜分析

  9. n=length(x);      

  10. n=2^nextpow2(n); %選取變換的點數

  11. t=(0:(n-1))/FS;%計算音頻信號的長度

  12. x=[x',zeros(1,n-length(x))]';

  13. figure(1);

  14. subplot(2,1,1); plot(t,x); axis tight; title('語音信號時域圖'); xlabel('t/s');ylabel('幅度')

  15. y=fft(x,n);          %對n點進行傅里葉變換到頻域

  16. f=FS*(0:n/2-1)/n;             % 對應點的頻率

  17. subplot(2,1,2);

  18. plot(f,abs(y(1:n/2)));axis tight;xlabel('f/Hz');ylabel('幅度');title('語音信號頻域圖');

  19. pause(2.5);

  20. %###########################################################################################################

  21. %產生噪聲信號

  22. noise=1*sin(2*pi*20000*t)+1*sin(2*pi*200*t);

  23. Noise=fft(noise,n);%對n點進行傅里葉變換到頻域

  24. figure(2);

  25. subplot(2,1,1);plot(t,noise);axis tight;xlabel('t/s');ylabel('幅度');title('加噪聲信號時域圖');

  26. subplot(2,1,2)

  27. plot(f,abs(Noise(1:n/2)));     %加噪語音信號的頻譜圖

  28. axis axis([1 40000 1 50000] );xlabel('f/Hz');ylabel('幅度');title('加噪語音信號頻譜圖');

  29. pause(1);

  30. %#############################################################################################################

  31. x1=x+noise';  %將兩個信號疊加成一個新的信號——加噪聲處理

  32. sound(x1,FS);

  33. %加噪后頻譜分析

  34. noise_1=fft(x1,n);%對n點進行傅里葉變換到頻域

  35. figure(3);

  36. subplot(2,1,1)

  37. plot(t,x1);axis tight;xlabel('t/s');ylabel('幅度');title('加噪聲信號時域圖');

  38. subplot(2,1,2)

  39. plot(f,abs(noise_1(1:n/2)));     %加噪語音信號的頻譜圖

  40. axis ([1 30000 1 4000] ;xlabel('f/Hz');ylabel('幅度');title('加噪語音信號頻譜圖');

  41. pause(2.5);

  42. %#################################################################################################################

  43. %hamming窗帶通濾波器設計

  44. fp1=200;fc1=100;

  45. fpu=8000;fcu=10000;

  46. wlp=2*pi*fp1/FS;wls=2*pi*fc1/FS;

  47. wup=2*pi*fpu/FS;wus=2*pi*fcu/FS;

  48. Bt=wlp-wls;            

  49. N0=ceil(6.6*pi/Bt);

  50. N=N0+mod(N0+1,2);

  51. wc=[(wls+wlp)/2/pi,(wus+wup)/2/pi];   

  52. hn=fir1(N-1,wc,hamming(N));

  53. [h1,w1] = freqz(hn,1,512,FS);

  54. figure(4);

  55. subplot(2,1,1);plot(hn);axis tight;xlabel('n');ylabel('幅度');title('hamming窗帶通時域圖');

  56. subplot(2,1,2);plot(w1,abs(h1));title('hamming窗帶通頻譜圖');axis ([700 900 -0.5 1]);xlabel('f/Hz');ylabel('耗損(dB)');

  57. pause(1);

  58. %#################################################################################################################

  59. %對濾波后的信號進行分析變換

  60. X=conv(hn,x);

  61. n2=length(X);      

  62. n2=2^nextpow2(n2);

  63. f=FS*(0:n2/2-1)/n2;  

  64. figure(5);subplot(2,1,1);plot(X);title('濾波后的信號時域圖');axis tight;xlabel('f/Hz');ylabel('幅度');

  65. X1=fft(X,n2);subplot(2,1,2);plot(f,abs(X1(1:n2/2))); axis tight;xlabel('f/Hz');ylabel('幅度');title('濾波后的信號頻譜');

  66. sound(X,FS);
復制代碼

完整的Word格式文檔51黑下載地址:
Hamming窗帶通濾波器.docx (82.7 KB, 下載次數: 20)

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表