




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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(原始聲音信號(hào)的波形);y1=y(100:199);axes(handles.axes2);plot(y1);grid;title(截取聲音信號(hào)的波形);% - 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(截取聲音信號(hào)的波形);t=0:0.01:2;y2=abs(fft(y1,512);f=100*(0:256)/512; %進(jìn)行對(duì)應(yīng)的頻率轉(zhuǎn)換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(原始聲音信號(hào)的波形);y1=fft(y,100); f=0:Fs/99:Fs;axes(handles.axes2);plot(f,abs(y1);grid;title(原始聲音信號(hào)的頻譜);% - 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(原始聲音信號(hào)的波形);y1=fft(y,1000); y2=abs(
7、y1);axes(handles.axes2);plot(y2);grid;title(原始聲音信號(hào)的幅值);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(原始聲音信號(hào)的波形);y1=fft(y,1000); y2=angle(y1);axes(handles.axes2);plot(y2);grid;title(原始聲音信號(hào)的相位);% - 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、號(hào)的波形);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(原始聲音信號(hào)的波形);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(截取聲音信號(hào)的波形);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(截取聲音信號(hào)的波形);R=xcorr(y1);axes(handles.axes2);plot(R);grid;title(自相關(guān)函數(shù));% - 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(截取聲音信號(hào)的波形);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(截取聲音信號(hào)的波形);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(截取聲音信號(hào)的均值)% - 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(截取聲音信號(hào)的波形);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(截取聲音信號(hào)的方差);% - 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(截取聲音信號(hào)的波形);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、(截取聲音信號(hào)的均方值);% - 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ào)的波形);h=ones(1,10) zeros(1,10);y2=conv(h,y1);axes(handles.axes2);stem(y2,.);grid;title(截取聲音信號(hào)的卷積);% - 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(截取聲音信號(hào)的波形);A=1,-1.8237,0
26、.9801;B=1/100.49,0,-1/100.49;Y=filter(B,A,y1); %對(duì)聲音濾波axes(handles.axes2);stem(Y,.);grid;title(截取聲音信號(hào)的響應(yīng));% - 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(截取聲音信號(hào)的波形);Y=fft(y1,50);axes(handles.axes2);stem(Y,.);axis();grid;title(截取聲音信號(hào)的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(截取聲音信號(hào)的波形);n=length(y1);window=boxcar(n); h,w=freqz(window,1); %求數(shù)字濾波器的復(fù)頻率響應(yīng)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); %確定低通濾波器的階數(shù)和截止頻率;b,a=butter(N1,wc1); %確定低通濾波器分子分母系數(shù)y=filter(b,a,x); %濾波axes(handles.axes1);plot(y);grid;xlabel(n)ylabel(信號(hào)幅值m)title(IIR濾波器解調(diào)信號(hào)); %解調(diào)濾波后的波形Y=fft(y); %濾波后的波形做離散傅里葉變換w=2*0:length(Y)-1/length(Y); %進(jìn)行對(duì)應(yīng)的頻率轉(zhuǎn)換axes(handles.axes2);plot(w,abs(Y);grid;xlabel(w/pi)ylabel(幅度Y)title(IIR濾波器解調(diào)信號(hào)
32、頻譜); %解調(diào)濾波后的頻譜% - 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(截取聲音信號(hào)的波形);y2=real(specgram(y1);axes(handles.axes2);plot(y2);grid;title(短時(shí)傅里葉分析);% - 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(截取聲音信號(hào)的波形);y2=awgn(y1,10); %在某一信號(hào)中加入高斯白噪聲 axes(handles.axes2);plot(y2);title(加高斯白噪聲語(yǔ)音信號(hào)的時(shí)域波形)由于最近的Project要做聲音分析,需要用到MATLAB,之前一直沒(méi)怎么接觸過(guò),所以乘著做Project學(xué)習(xí)下。真的用了才知道MATLAB真是神器啊,呵呵其強(qiáng)大的函數(shù)庫(kù)和數(shù)學(xué)運(yùn)算能力徹底讓我折服了。言歸正傳,我們來(lái)討論下用MATLAB做聲音文件處理。1. 讀取WAV聲音文件% wavread(filename) 讀取一個(gè)WAVE文件,并返回采樣數(shù)據(jù)到向量y中,F(xiàn)s表示采樣頻率, bits表示采樣位數(shù)y, Fs, bits =
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 別墅擴(kuò)建土建合同范本
- 衛(wèi)浴勞動(dòng)合同范本
- 音樂(lè) 課題申報(bào)書
- 國(guó)家立項(xiàng)課題申報(bào)書
- 合同附合同范本
- 單項(xiàng)委托預(yù)定酒店合同范本
- 養(yǎng)殖土雞合同范本
- 中環(huán)租房合同范本
- 美術(shù)類課題申報(bào)書
- 員工雇用協(xié)議合同范本
- 經(jīng)濟(jì)法學(xué)學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 道法滋養(yǎng)心靈+課件- 2024-2025學(xué)年統(tǒng)編版道德與法治七年級(jí)上冊(cè)
- 醫(yī)院培訓(xùn)課件:《嚴(yán)重創(chuàng)傷快速轉(zhuǎn)診機(jī)制》
- 基于杜邦分析法的蔚來(lái)汽車經(jīng)營(yíng)財(cái)務(wù)分析及建議
- 2024人教版初中數(shù)學(xué)新教材培訓(xùn)心得體會(huì)
- TCECA-G 0310-2024 離網(wǎng)制氫靈活消納與柔性化工系統(tǒng)開(kāi)發(fā)規(guī)范
- 產(chǎn)科腹部四步觸診要點(diǎn)
- 2024年3月時(shí)政熱點(diǎn)(一)
- 2024天津市衛(wèi)生健康委員會(huì)所屬天津市衛(wèi)生健康促進(jìn)中心選聘3人(高頻重點(diǎn)復(fù)習(xí)提升訓(xùn)練)共500題附帶答案詳解
- 咨詢行業(yè)人工智能應(yīng)用研究
- SLT 478-2021 水利數(shù)據(jù)庫(kù)表結(jié)構(gòu)及標(biāo)識(shí)符編制總則
評(píng)論
0/150
提交評(píng)論