自数字信号处理实验8音频频谱分析仪设计与实现Word格式.docx
- 文档编号:17460165
- 上传时间:2022-12-01
- 格式:DOCX
- 页数:36
- 大小:549.70KB
自数字信号处理实验8音频频谱分析仪设计与实现Word格式.docx
《自数字信号处理实验8音频频谱分析仪设计与实现Word格式.docx》由会员分享,可在线阅读,更多相关《自数字信号处理实验8音频频谱分析仪设计与实现Word格式.docx(36页珍藏版)》请在冰豆网上搜索。
其原理即是将重复的三角函数算计的中间结果保存起来,以减少重复三角函数计算带来的时间浪费。
由于三角函数计算的重复量相当大,故FFT能极大地提高运算效率。
(2)频率、周期的估计
对于Y(kΔf),如果当kΔf= 时,Y(kΔf)取最大值,则为频率的估计值,由于采样间隔的误差,也存在误差,其误差最大为Δf /2。
周期T=1/f。
从原理上可以看出,如果在标准信号中混有噪声,用上述方法仍能够精确地估计出原标准信号的频率和周期,这个将在下一章做出验证
3、频谱图
为了直观地表示信号的频率特性,工程上常常将Fourier变换的结果用图形的方式表示,即频谱图。
以频率f为横坐标,|Y(f)|为纵坐标,可以得到幅值谱;
以频率f为横坐标,argY(f)为纵坐标,可以得到相位谱;
以频率f为横坐标,ReY(f)为纵坐标,可以得到实频谱;
以频率f为横坐标,ImY(f)为纵坐标,可以得到虚频谱。
根据采样定理,只有频率不超过Fs/2的信号才能被正确采集,即Fourier变换的结果中频率大于Fs/2的部分是不正确的部分,故不在频谱图中显示。
即横坐标f∈[0,Fs/2]
4、模块划分
模块化就是把程序划分成独立命名且可独立访问的模块,每个模块完成一个子功能,把这些模块集成起来构成一个整体,可以完成指定的功能满足用户需求。
根据人类解决一般问题的经验,如果一个问题由两个问题组合而成,那么它的复杂程度大于分别考虑每个问题时的复杂程度之和,也就是说把复杂的问题分解成许多容易解决的小问题,原来的问题也就容易解决了。
这就是模块化的根据。
在模块划分时应遵循如下规则:
改进软件结构提高模块独立性;
模块规模应该适中;
深度、宽度、扇出和扇入都应适当;
模块的作用域应该在控制域之内;
力争降低模块接口的复杂程度;
设计单入口单出口的模块;
模块功能应该可以预测。
三、实验要求:
参考以上原理,查阅相关资料,构建交互界面,设计一个音频频谱分析仪,实现一下功能:
(1)音频信号信号输入,从声卡输入、从WAV文件输入、从标准信号发生器输入;
(2)信号波形分析,包括幅值、频率、周期、相位的估计,以及统计量峰值、均值、均方值和方差的计算;
(3)信号频谱分析,频率、周期的估计,图形显示幅值谱、相位谱、实频谱、虚频谱和功率谱的曲线。
四、实验界面及程序
程序:
functionvarargout =yinpin(varargin)
%YINPIN M-yinpin.fig
% YINPIN,byitself,createsanewYINPINorraises the existing
%singleton*.
%
% H= YINPINreturnsthehandletoanewYINPINorthehandle to
% the existingsingleton*.
%
% YINPIN('CALLBACK'
,hObject,eventData,handles,...)callsthelocal
% functionnamed CALLBACKinYINPIN.Mwiththegiveninputarguments.
%
%YINPIN('
Property'
,'
Value',...)createsanewYINPIN orraises the
% existing singleton*.Startingfrom theleft,propertyvaluepairs are
% applied totheGUIbefore yinpin_OpeningFunctiongets called.An
% unrecognizedproperty name orinvalid valuemakespropertyapplication
% stop.Allinputsarepassedtoyinpin_OpeningFcn viavarargin.
%
% *SeeGUIOptionsonGUIDE'
sTools menu. Choose"
GUIallowsonlyone
%instancetorun(singleton)".
%See also:
GUIDE,GUIDATA,GUIHANDLES
%Edit theabove text tomodifytheresponsetohelpyinpin
%LastModifiedbyGUIDEv2.5 07-Nov-201217:
08:
53
% Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('
gui_Name'
, m, ...
'
gui_Singleton'
gui_Singleton,...
'
gui_OpeningFcn'
, @yinpin_OpeningFcn, ...
'
gui_OutputFcn'
,@yinpin_OutputFcn, ...
'
gui_LayoutFcn'
[] ,...
'
gui_Callback',[]);
if nargin&
&
ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
if nargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
});
end
%Endinitialization code -DONOTEDIT
%---Executes justbefore yinpinis made visible.
functionyinpin_OpeningFcn(hObject, eventdata,handles, varargin)
%Thisfunction has nooutputargs, seeOutputFcn.
% hObjecthandle tofigure
% eventdatareserved -tobe definedinafutureversionofMATLAB
%handlesstructurewithhandles and userdata(seeGUIDATA)
%varargincommandline argumentstoyinpin(seeVARARGIN)
%Choosedefault commandlineoutput foryinpin
handles.output =hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakes yinpinwaitforuser response(seeUIRESUME)
% uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedto thecommandline.
functionvarargout=yinpin_OutputFcn(hObject, eventdata, handles)
% varargout cell array forreturningoutputargs(seeVARARGOUT);
%hObject handleto figure
%eventdatareserved-to bedefinedina future version ofMATLAB
% handles structurewithhandlesanduserdata(seeGUIDATA)
%Getdefaultcommandlineoutputfromhandles structure
varargout{1}= handles.output;
% --- Executesduringobjectcreation, aftersettingallproperties.
functionedit1_CreateFcn(hObject,eventdata, handles)
%hObjecthandletoedit1(see GCBO)
%eventdatareserved- tobe definedinafutureversionof MATLAB
%handlesempty-handles notcreated untilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhave awhitebackgroundonWindows.
% SeeISPCandCOMPUTER.
ifispc&
&isequal(get(hObject,'
BackgroundColor'
), get(0,'
defaultUicontrolBackgroundColor'
))
set(hObject,'BackgroundColor'
,'white');
end
%---Executesduring objectcreation,after settingall properties.
functioncaiyangpinlv_CreateFcn(hObject, eventdata,handles)
%hObject handletocaiyangpinlv(seeGCBO)
%eventdatareserved- tobedefinedinafuture version of MATLAB
%handlesempty -handlesnotcreated untilafterallCreateFcnscalled
%Hint:
editcontrols usuallyhave awhitebackgroundonWindows.
% See ISPC and COMPUTER.
ifispc&&
isequal(get(hObject,'
BackgroundColor'
),get(0,'
defaultUicontrolBackgroundColor'
set(hObject,'
BackgroundColor'
white'
);
end
%---Executesduringobjectcreation,aftersetting all properties.
functioncaiyangdianshu_CreateFcn(hObject,eventdata,handles)
%hObject handle to caiyangdianshu(seeGCBO)
%eventdatareserved-tobedefined inafutureversion ofMATLAB
%handles empty-handles notcreateduntilafterallCreateFcnscalled
% Hint:
editcontrols usuallyhaveawhitebackgroundon Windows.
% SeeISPCandCOMPUTER.
ifispc&
isequal(get(hObject,'BackgroundColor'
),get(0,'
defaultUicontrolBackgroundColor'
set(hObject,'
BackgroundColor'
'
white');
end
% --- Executesonbuttonpressinluyin.
functionluyin_Callback(hObject,eventdata,handles)
%hObjecthandleto luyin(seeGCBO)
%eventdata reserved -to be definedin afuture version ofMATLAB
%handlesstructure withhandlesanduserdata(seeGUIDATA)
%Hint:
get(hObject,'Value'
) returns togglestateofluyin
set(handles.luyin,'
value'
1);
set(handles.wavfile,'value'
0);
set(handles.xinhaofasheng,'
value',0);
h=findobj('Tag'
'recordtime'
);
ﻩ
set(h,'
enable','
on'
h=findobj('
Tag'
kaishiluyin'
set(h,'enable','
on'
h=findobj('
Tag'
wavname'
set(h,'
enable'
off'
h=findobj('
Tag'
,'liulan'
set(h,'enable','
off');
h=findobj('
Tag','inwave'
set(h,'
enable'
'off'
h=findobj('
Tag','
infudu'
set(h,'
enable','
h=findobj('
,'infre'
set(h,'enable','
off');
h=findobj('
'inphase');
set(h,'
enable'
h=findobj('
mix'
enable'
'off');
h=findobj('
'shengchengboxing'
set(h,'enable'
% ---Executeson buttonpressinwavfile.
function wav(hObject, eventdata,handles)
% hObject handleto wavfile(seeGCBO)
% eventdata reserved-tobedefinedinafutureversionofMATLAB
% handlesstructurewith handlesanduser data (seeGUIDATA)
% Hint:
get(hObject,'
Value'
)returnstogglestateofwavfile
set(handles.luyin,'value'
0);
set(handles.wavfile,'
value'
set(handles.xinhaofasheng,'
value',0);
h=findobj('
Tag','
recordtime');
set(h,'
Tag','
kaishiluyin'
set(h,'
enable','
off');
h=findobj('
wavname'
set(h,'
enable'
on'
h=findobj('Tag'
liulan');
set(h,'enable'
h=findobj('Tag','
inwave'
set(h,'enable'
h=findobj('
'infudu'
set(h,'
'off');
h=findobj('Tag'
infre'
set(h,'enable'
h=findobj('
Tag','inphase');
set(h,'
enable'
,'off'
h=findobj('
mix'
set(h,'enable'
h=findobj('
shengchengboxing');
set(h,'
enable'
'off'
%---Executesonbuttonpressinxinhaofasheng.
functionxinhaofasheng_Callback(hObject,eventdata,handles)
% hObject handletoxinhaofasheng(seeGCBO)
% eventdatareserved-to bedefined inafutureversionofMATLAB
%handles structurewith handlesanduserdata(seeGUIDATA)
% Hint:
get(hObject,'
Value'
)returnstogglestateof xinhaofasheng
set(handles.luyin,'
value'
,0);
set(handles.wavfile,'value'
0);
set(handles.xinhaofasheng,'value',1);
h=findobj('Tag'
recordtime'
set(h,'
enable','off'
h=findobj('Tag'
kaishiluyin'
set(h,'
enable'
off');
h=findobj('Tag'
wavname'
set(h,'
enable','
h=findobj('
Tag'
'liulan'
set(h,'enable'
h=findobj('
'inwave'
set(h,'enable'
h=findobj('Tag'
'infudu');
set(h,'
enable','
h=findobj('
'infre');
set(h,'
enable'
'on'
h=findobj('
inphase'
enable','
h=findobj('
mix'
set(h,'
enable','on');
h=findobj('
Tag'
shengchengboxing'
set(h,'enable','
%---Executes duringobjectcreation, after settingallproperties.
functionrecordtime_CreateFcn(hObject, eventdata,handles)
%hObject handle to recordtime (seeGCBO)
%eventdata reserved-tobedefinedin afutureversionofMATLAB
%handlesempty -handlesnot created untilafteral
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数字信号 处理 实验 音频 频谱 分析 设计 实现
![提示](https://static.bdocx.com/images/bang_tan.gif)