【正文】
同時,本作品還有待改進和完善,如可以對函數(shù)進行加窗分析,還可以把分析結果導出來稱特定格式的文件,等等。power39。)。 xlabel(,39。freqency(Hz)39。 plot(,f,angle(Y))。 end if(==3) set(,39。,39。String39。 if ==0 msgbox(39。))。pleas wait...39。 ysize=size()。)。,mean((from:to).^2))。 %peak set(,39。,num2str(freq))。,39。 end freq=Fs/mean(T)。 end amp(n)=(ymaxymin)/2。)。String39。 if ==0 msgbox(39。))。white39。amp。), get(0,39。BackgroundColor39。)。 isequal(get(hObject,39。defaultUicontrolBackgroundColor39。,39。 end % Executes during object creation, after setting all properties. function edit24_CreateF(hObject, eventdata, handles) % hObject handle to edit24 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB % handles empty handles not created until after all CreateFs called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc amp。BackgroundColor39。)) set(hObject,39。white39。amp。), get(0,39。BackgroundColor39。)。 isequal(get(hObject,39。defaultUicontrolBackgroundColor39。,39。 end function edit9_CreateF(hObject, eventdata, handles) if ispc amp。BackgroundColor39。)) set(hObject,39。white39。amp。), get(0,39。BackgroundColor39。)。 isequal(get(hObject,39。)。 end if get(,39。 case 2 y=amp*sign(sin(2*pi*x*frequency+phase))。 amp=str2double(get(,39。))。String39。,39。 end function inphase_CreateF(hObject, eventdata, handles) if ispc amp。BackgroundColor39。)) set(hObject,39。white39。amp。), get(0,39。,num2str(ysize(1)))。,filename)。)。 isequal(get(hObject,39。 guidata(hObject,handles)。))。defaultUicontrolBackgroundColor39。,39。)。Tag39。inphase39。 set(h,39。,39。)。Tag39。liulan39。 set(h,39。,39。)。Tag39。,0)。)。enable39。off39。 h=findobj(39。,39。)。enable39。on39。 h=findobj(39。,39。)。enable39。value39。)。Tag39。mix39。 set(h,39。,39。)。Tag39。inwave39。 set(h,39。,39。)。Tag39。recordtime39。value39。BackgroundColor39。)。 isequal(get(hObject,39。defaultUicontrolBackgroundColor39。 end function yinpin_OpeningF(hObject, eventdata, handles, varargin) = hObject。, [] , ... 39。, mfilename, ... 39。,hObject,eventData,handles,...) calls the local % function named CALLBACK in with the given input arguments. % % YINPIN(39。根據(jù)采樣定理,只有頻率不超過Fs/2的信號才能被正確采集,即Fourier變換的結果中頻率大于Fs/2的部分是不正確的部分,故不在頻譜圖中顯示。采樣信號的頻譜是一個連續(xù)的頻譜,不可能計算出所有的點的值,故采用離散Fourier變換(DFT),即式中,Δf = Fs/N。φ=2π(1ti/T),{x}表示x的小數(shù)部分,同樣,以φ的平均值作為相位的估計值。信號處理實驗實驗八:音頻頻譜分析儀設計與實現(xiàn) 實驗名稱:音頻頻譜分析儀設計與實現(xiàn) 實驗原理:MATLAB是一個數(shù)據(jù)信息和處理功能十分強大的工程實用軟件,其數(shù)據(jù)采集工具箱為實現(xiàn)數(shù)據(jù)的輸入和輸出提供了十分方便的函數(shù)和命令。頻率、幅值和相位估計的流程如圖所示。但上式的計算效率很低,因為有大量的指數(shù)(等價于三角函數(shù))運算,故實際中多采用快速Fourier變換(FFT)。即橫坐標f ∈[0, Fs/2]模塊劃分模塊化就是把程序劃分成獨立命名且可獨立訪問的模塊,每個模塊完成一個子功能,把這些模塊集成起來構成一個整體,可以完成指定的功能滿足用戶需求。Property39。gui_Singleton39。gui_Callback39。 guidata(hObject, handles)。)) set(hObject,39。BackgroundColor39。 end function caiyangdianshu_CreateF(hObject, eventdata, handles) if ispc amp。,39。,0)。)。,39。 h=findobj(39。off39。enable39。)。,39。 h=findobj(39。off39。enable39。)。,39。 function wavfile_Callback(hObject, eventdata, handles) set(,39。,0)。,39。 set(h,39。wavname39。Tag39。)。,39。 set(h,39。infre39。Tag39。)。,39。 set(h,39。 set(,39。,39。 h=findobj(39。off39。enable39。)。,39。 h=findobj(39。on39。enable39。)。,39。 h=findobj(39。on39。)) set(hObject,39。 N=str2double(get(,39。 plot(,)。BackgroundColor39。 end function liulan_Callback(hObject, eventdata, handles) [filename,filepath]=uigetfile(39。 [,Fs,bit]=wavread(filename)。 set(,39。defaultUicontrolBackgroundColor39。 isequal(get(hObject,39。)。BackgroundColor39。), get(0,39。amp。white39。))。 x=linspace(0,N/Fs,N)。String39。 =3。Value39。 axis([0 N str2double(get(,39。BackgroundColor39。 end function edit12_CreateF(hObject, eventdata, handles) if ispc amp。,39。defaultUicontrolBackgroundColor39。 isequal(get(hObject,39。)。BackgroundColor39。), get(0,39。amp。white39。)) set(hObject,39。BackgroundColor39。 end function outfreq_CreateF(hObject, eventdata, handles) if ispc amp。,39。defaultUicontrolBackgroundColor39。 isequal(get(hObject,39。)。BackgroundColor39。), get(0,39。amp。white39。)) set(hObject,39。BackgroundColor39。 end % Executes during object creation, after setting all properties. function foutfreq_CreateF(hObject,