




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、% - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bit
2、s = wavread(H:cwcw.wav)axes(handles.axes1);plot(y);grid;title(原始聲音信號的波形);y1=y(100:199);axes(handles.axes2);plot(y1);grid;title(截取聲音信號的波形);% - Executes on button press in pushbutton18.function pushbutton18_Callback(hObject, eventdata, handles)% hObject handle to pushbutton18 (see GCBO)% eventdata res
3、erved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(100:199);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);t=0:0.01:2;y2=abs(fft(y1,512);f=100*(0:256)/512; %進行對應的頻率轉換axes(handles
4、.axes2);plot(f,y2(1:257);grid;title(FFT變換后波形);% - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user da
5、ta (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)axes(handles.axes1);plot(y);grid;title(原始聲音信號的波形);y1=fft(y,100); f=0:Fs/99:Fs;axes(handles.axes2);plot(f,abs(y1);grid;title(原始聲音信號的頻譜);% - Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, ha
6、ndles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)axes(handles.axes1);plot(y);grid;title(原始聲音信號的波形);y1=fft(y,1000); y2=abs(
7、y1);axes(handles.axes2);plot(y2);grid;title(原始聲音信號的幅值);xlabel(Hz);ylabel(FuZhi);% - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles
8、structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)axes(handles.axes1);plot(y);grid;title(原始聲音信號的波形);y1=fft(y,1000); y2=angle(y1);axes(handles.axes2);plot(y2);grid;title(原始聲音信號的相位);% - Executes on button press in pushbutton5.function pushbutton5_Ca
9、llback(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)axes(handles.axes1);plot(y);grid;title(原始聲音信
10、號的波形);t=0:0.001:1;y=randn(size(t); axes(handles.axes2);plot(y),axis(0 1000 -5 5),grid on;title(加高斯白噪聲的波形)% - Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future ve
11、rsion of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(原始聲音信號的波形);axes(handles.axes2);hist(y1);axis();title(直方圖);% - Executes on button press in pushbutton7.function pushbutt
12、on7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(
13、y1);grid;title(截取聲音信號的波形);N=length(y1);i=1:N;f,i=ksdensity(y1);axes(handles.axes2);plot(i,f);grid;xlabel(x);ylabel(f(x);axis();title(概率密度);% - Executes on button press in pushbutton8.function pushbutton8_Callback(hObject, eventdata, handles)% hObject handle to pushbutton8 (see GCBO)% eventdata reser
14、ved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);R=xcorr(y1);axes(handles.axes2);plot(R);grid;title(自相關函數);% - Executes on
15、button press in pushbutton9.function pushbutton9_Callback(hObject, eventdata, handles)% hObject handle to pushbutton9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cw
16、cw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);t=0:1/Fs:1;axes(handles.axes2);y2=periodogram(y1,1000,Fs);plot(y2);axis();grid ontitle(功率譜);% - Executes on button press in pushbutton10.function pushbutton10_Callback(hObject, eventdata, handles)% hObject handle to pushbutton10
17、(see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);n=length(y1);x=randn(50,n);average=zeros(1,50);
18、for i=1:50 for j=1:1000 average(i)=average(i)+x(i,j); end average(i)=average(i)/1000; endEX=sum(average)/50;axes(handles.axes2);plot(average); grid;title(截取聲音信號的均值)% - Executes on button press in pushbutton11.function pushbutton11_Callback(hObject, eventdata, handles)% hObject handle to pushbutton11
19、 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);n=length(y1);x=randn(50,n);average=zeros(1,50)
20、;for i=1:50 for j=1:1000 average(i)=average(i)+x(i,j); end average(i)=average(i)/1000; endEX=sum(average)/50;variance=zeros(1,50);for i=1:50 for j=1:1000 variance(i)=variance(i)+(x(i,j)-average(i).2; end variance(i)=variance(i)/1000;endDX=sum(variance)/50;axes(handles.axes2);plot(variance); grid;tit
21、le(截取聲音信號的方差);% - Executes on button press in pushbutton12.function pushbutton12_Callback(hObject, eventdata, handles)% hObject handle to pushbutton12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:c
22、wcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);n=length(y1);x=randn(50,n);square=zeros(1,50);for i=1:50 for j=1:1000 square(i)=square(i)+x(i,j).2; end square(i)=square(i)/1000; endRMS=sum(square)/50;axes(handles.axes2);plot(square); grid;title
23、(截取聲音信號的均方值);% - Executes on button press in pushbutton13.function pushbutton13_Callback(hObject, eventdata, handles)% hObject handle to pushbutton13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cw
24、cw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(100:199);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);h=ones(1,10) zeros(1,10);y2=conv(h,y1);axes(handles.axes2);stem(y2,.);grid;title(截取聲音信號的卷積);% - Executes on button press in pushbutton14.function pushbutton14_Callback(hObject, eventdata, handles)
25、% hObject handle to pushbutton14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(100:199);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);A=1,-1.8237,0
26、.9801;B=1/100.49,0,-1/100.49;Y=filter(B,A,y1); %對聲音濾波axes(handles.axes2);stem(Y,.);grid;title(截取聲音信號的響應);% - Executes on button press in pushbutton15.function pushbutton15_Callback(hObject, eventdata, handles)% hObject handle to pushbutton15 (see GCBO)% eventdata reserved - to be defined in a future
27、 version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(100:199);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);Y=fft(y1,50);axes(handles.axes2);stem(Y,.);axis();grid;title(截取聲音信號的DFT波形);xlabel(w/pi);ylabel(Fuzhi);%
28、- Executes on button press in pushbutton16.function pushbutton16_Callback(hObject, eventdata, handles)% hObject handle to pushbutton16 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bi
29、ts = wavread(H:cwcw.wav)y1=y(100:199);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);n=length(y1);window=boxcar(n); h,w=freqz(window,1); %求數字濾波器的復頻率響應axes(handles.axes2);stem(window);title(加矩形窗后的波形);figure(1);plot(w/pi,20*log(abs(h)/abs(h(1);grid;title(加矩形窗后的頻率分析);% - Executes on button press in
30、 pushbutton17.function pushbutton17_Callback(hObject, eventdata, handles)% hObject handle to pushbutton17 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)x,fs,bits=wavread(H:cwcw.wav);N1,wc1=buttord(0.15,0.20,1,1
31、5); %確定低通濾波器的階數和截止頻率;b,a=butter(N1,wc1); %確定低通濾波器分子分母系數y=filter(b,a,x); %濾波axes(handles.axes1);plot(y);grid;xlabel(n)ylabel(信號幅值m)title(IIR濾波器解調信號); %解調濾波后的波形Y=fft(y); %濾波后的波形做離散傅里葉變換w=2*0:length(Y)-1/length(Y); %進行對應的頻率轉換axes(handles.axes2);plot(w,abs(Y);grid;xlabel(w/pi)ylabel(幅度Y)title(IIR濾波器解調信號
32、頻譜); %解調濾波后的頻譜% - Executes on button press in pushbutton19.function pushbutton19_Callback(hObject, eventdata, handles)% hObject handle to pushbutton19 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:c
33、wcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);y2=real(specgram(y1);axes(handles.axes2);plot(y2);grid;title(短時傅里葉分析);% - Executes on button press in pushbutton20.function pushbutton20_Callback(hObject, eventdata, handles)% hObject handle to pu
34、shbutton20 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)y=wavread(H:cwcw.wav);y,Fs,bits = wavread(H:cwcw.wav)y1=y(1:1000);axes(handles.axes1);plot(y1);grid;title(截取聲音信號的波形);y2=awgn(y1,10); %在某一信號中加入高斯白噪聲 axes(handles.axes2);plot(y2);title(加高斯白噪聲語音信號的時域波形)由于最近的Project要做聲音分析,需要用到MATLAB,之前一直沒怎么接觸過,所以乘著做Project學習下。真的用了才知道MATLAB真是神器啊,呵呵其強大的函數庫和數學運算能力徹底讓我折服了。言歸正傳,我們來討論下用MATLAB做聲音文件處理。1. 讀取WAV聲音文件% wavread(filename) 讀取一個WAVE文件,并返回采樣數據到向量y中,Fs表示采樣頻率, bits表示采樣位數y, Fs, bits =
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 安全工程師職業(yè)發(fā)展指導試題及答案
- 水管流水測試題及答案
- 新能源汽車市場的品牌差異化策略試題及答案
- 新零售趨勢下實體零售門店線上線下融合營銷策略研究報告
- 黃埔招教面試真題及答案
- 食品添加劑安全評估與2025年食品加工工藝改進研究報告
- 2025年消防安全考試題及答案
- 社交廢物面試題及答案
- 深度分析:2025年環(huán)境監(jiān)測行業(yè)智能化發(fā)展與數據質量控制創(chuàng)新
- 快遞網管面試題及答案
- DL-T+1860-2018自動電壓控制試驗技術導則
- 單螺桿泵說明書
- JT-T-1213-2018陸港設施設備配置和運營技術規(guī)范
- 五年級勞動課件收納
- 行政復議法-形考作業(yè)2-國開(ZJ)-參考資料
- 2023-2024學年人教版數學八年級下冊期中復習卷
- (高清版)TDT 1044-2014 生產項目土地復墾驗收規(guī)程
- MBA-組織行為學課件
- 白云枕頭-模板參考
- 奧迪汽車介紹
- 心衰超濾治療
評論
0/150
提交評論