已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
课题一数字信号处理系统设计1、 项目要求用本课程所学的数字信号处理理论知识,设计一个具有信号的采集、处理、传输、显示和存储等功能的系统,内容如下:、 录制一段语音信号,并对录制的语音信号进行采样(采样频率可取fs=22050Hz);、 画出采样后的语音信号的时域波形和频谱图;、 滤波器的性能指标:低通滤波器:通带边界频率,通带最大衰减B;阻带边界频率.2,阻带最小衰减00B;高通滤波器:通带边界频率5,通带最大衰减B;阻带边界频率4.8,阻带最小衰减00B;带通滤波器:通带上限截止频率fp2=3kHz, 通带下限截止频率fp1=1.2kHz; 阻带上限截止频率fs2=3.2kHz, 通带下限截止频率fp1=1kHz; 通带最大衰减Ap=1dB, 阻带最小衰减As=100dB;采用双线性变换法设计滤波器,并画出滤波器的频率响应;、 用自己设计的滤波器对采样的信号进行滤波,画出滤波后信号的时域波形和频谱图,并对滤波前后的信号进行对比,分析信号的变化;、 回放语音、 用设计一个信号系统的用户界面。二、实验所要用到的函数、语音信号的采样与播放wavread();y,fs,bite=wavread();%语音信号的采样sound(y,fs,bite);%播放语音2. 滤波器:IIR:butte();%巴特沃思滤波器 cheby1();%切比雪夫I滤波器 elliptical();%椭圆滤波器3. 频率响应:h,f=freqz(b,a,n,fs)freqz(b,a,n,fs)5. 快速傅里叶变换fft (x, n)6. 画曲线plot(x, y)stem(x, y)7. 在MATLAB中,设计辅助低通原型巴特沃思和切比雪夫滤波器的阶数和截止频率;1) 利用buttord和cheblord确定阶数;2) num,den=butter(N,Wn),num,den=cheby1(N,Wn)3) lp2hp,lp2bp,lp2bs可以完成低通滤波器到高通,带通,带阻的转换4) 使用biliner对模拟滤波器进行双线性变换,求得数字滤波器的传输函数系数3、 数字滤波器(代码)1. IIR低通滤波器fp=1000;ft=5500;fs=1200;wp=2*pi*fp/ft;ws=2*pi*fs/ft;Fp=2*ft*tan(wp/2);Fs=2*ft*tan(ws/2);n,Omgc=buttord(Fp,Fs,1,100,s); z,p,k=buttap(n);B=k*real(poly(z);A=real(poly(p);b1,a1=lp2lp(B,A,Omgc);ba1,aa1=bilinear(b1,a1,ft); %模拟转数字Ha,w=freqz(ba1,aa1); %求频率相应plot(w*ft/(2*pi),20*log10(abs(Ha);title(IIR 低通滤波器);xlabel(频率/HZ);ylabel(幅值);2. IIR高通滤波器fp=5000;ft=25000;%取抽样频率fs=4800;Rp=1;As=100;wp=2*pi*fp/ft;%通带频率ws=2*pi*fs/ft;%截止频率Fp=2*ft*tan(wp/2);Fs=2*ft*tan(ws/2);n,Omgc=ellipord(Fp,Fs,Rp,As,s); %计算阶数n和截止频率z,p,k=ellipap(n,Rp,As);B3=k*real(poly(z);A3=real(poly(p);b3,a3=lp2hp(B3,A3,Omgc);ba3,aa3=bilinear(b3,a3,ft);Ha,w=freqz(ba3,aa3);plot(w*ft/(2*pi),20*log10(abs(Ha);title(IIR高通滤波器);xlabel(频率/HZ);ylabel(幅值);3. IIR带通滤波器fp1=1200;fp2=3000;fs1=1000;fs2=3200;ft=10000;As=100;Rp=1;wp1=2*pi*fp1/ft;wp2=2*pi*fp2/ft;ws1=2*pi*fs1/ft;ws2=2*pi*fs2/ft;Fp1=2*ft*tan(wp1/2);Fp2=2*ft*tan(wp2/2);Fp=Fp1,Fp2;Fs1=2*ft*tan(ws1/2);Fs2=2*ft*tan(ws2/2);Fs=Fs1,Fs2;bw=Fp2-Fp1;w0=sqrt(Fp1*Fp2);%通带宽和中心频率n,Omgn=cheb1ord(Fp,Fs,Rp,As,s);z,p,k=cheb1ap(n,Rp);B2=k*real(poly(z);A2=real(poly(p);b2,a2=lp2bp(B2,A2,w0,bw);ba2,aa2=bilinear(b2,a2,ft);Ha,w=freqz(ba2,aa2);plot(w*ft/(2*pi),20*log10(abs(Ha);title(IIR 带通滤波器);xlabel(频率/HZ);ylabel(幅值);4、 总代码function varargout = bzh(varargin)% BZH M-file for bzh.fig% BZH, by itself, creates a new BZH or raises the existing% singleton*.% H = BZH returns the handle to a new BZH or the handle to% the existing singleton*.% BZH(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in BZH.M with the given input arguments.% BZH(Property,Value,.) creates a new BZH or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before ko_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to bzh_OpeningFcn via varargin.% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES % Copyright 2002-2003 The MathWorks, Inc. % Edit the above text to modify the response to help bzh % Last Modified by GUIDE v2.5 09-Jan-2014 08:54:22 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, bzh_OpeningFcn, . gui_OutputFcn, bzh_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before bzh is made visible.function bzh_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to bzh (see VARARGIN) % Choose default command line output for bzhhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes bzh wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = bzh_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output; % - Executes on button press in tag_start.function tag_start_Callback(hObject, eventdata, handles)% hObject handle to tag_start (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1)cla;global z0;global yy;fs=22050;nbits=32;yy,fs,nbits=wavread(D:f.wav); %语音信号加载sound(yy,fs); %回放语音z0=yy;axes(handles.axes1);plot(yy);title(时域采样信号波形);grid onn=length(yy); %求出语音信号的长度Y=fft(yy,n); %傅里叶变换axes(handles.axes2);plot(20*log10(abs(Y);title(时域采样信号频谱);guidata(hObject,handles);grid on % - Executes on button press in tag_ditong.function tag_ditong_Callback(hObject, eventdata, handles)% hObject handle to tag_ditong (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1)cla;global z1;global yy;global ba1;global aa1;global Fp;global Fs;fp=1000;ft=5500;fs=1200;wp=2*pi*fp/ft;ws=2*pi*fs/ft;Fp=2*ft*tan(wp/2);Fs=2*ft*tan(ws/2);n,Omgc=buttord(Fp,Fs,1,100,s); z,p,k=buttap(n);B=k*real(poly(z);A=real(poly(p);b1,a1=lp2lp(B,A,Omgc);ba1,aa1=bilinear(b1,a1,ft); %模拟转数字z1=filter(ba1,aa1,yy);Ha,w=freqz(ba1,aa1); %求频率相应plot(w*ft/(2*pi),20*log10(abs(Ha);title(IIR 低通滤波器);xlabel(频率/HZ);ylabel(幅值); % - Executes on button press in tag_gaotong.function tag_gaotong_Callback(hObject, eventdata, handles)% hObject handle to tag_gaotong (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes2)cla;global yy;global z2;global B3;global ba3;global aa3;global Fp;global Fs;fp=5000;ft=25000;%取抽样频率fs=4800;Rp=1;As=100;wp=2*pi*fp/ft;%通带频率ws=2*pi*fs/ft;%截止频率Fp=2*ft*tan(wp/2);Fs=2*ft*tan(ws/2);n,Omgc=ellipord(Fp,Fs,Rp,As,s); %计算阶数n和截止频率z,p,k=ellipap(n,Rp,As);B3=k*real(poly(z);A3=real(poly(p);b3,a3=lp2hp(B3,A3,Omgc);ba3,aa3=bilinear(b3,a3,ft);z2=filter(ba3,aa3,yy);Ha,w=freqz(ba3,aa3);plot(w*ft/(2*pi),20*log10(abs(Ha);title(IIR高通滤波器);xlabel(频率/HZ);ylabel(幅值);% - Executes on button press in tag_daitong.function tag_daitong_Callback(hObject, eventdata, handles)% hObject handle to tag_daitong (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes3)cla;global yy;global z3;global B2;global ba2;global aa2;fp1=1200;fp2=3000;fs1=1000;fs2=3200;ft=10000;As=100;Rp=1;wp1=2*pi*fp1/ft;wp2=2*pi*fp2/ft;ws1=2*pi*fs1/ft;ws2=2*pi*fs2/ft;Fp1=2*ft*tan(wp1/2);Fp2=2*ft*tan(wp2/2);Fp=Fp1,Fp2;Fs1=2*ft*tan(ws1/2);Fs2=2*ft*tan(ws2/2);Fs=Fs1,Fs2;bw=Fp2-Fp1;w0=sqrt(Fp1*Fp2);%通带宽和中心频率n,Omgn=cheb1ord(Fp,Fs,Rp,As,s);z,p,k=cheb1ap(n,Rp);B2=k*real(poly(z);A2=real(poly(p);b2,a2=lp2bp(B2,A2,w0,bw);ba2,aa2=bilinear(b2,a2,ft);z3=filter(ba2,aa2,yy);Ha,w=freqz(ba2,aa2);plot(w*ft/(2*pi),20*log10(abs(Ha);title(IIR 带通滤波器);xlabel(频率/HZ);ylabel(幅值); % - Executes on button press in tag_dibo.function tag_dibo_Callback(hObject, eventdata, handles)% hObject handle to tag_dibo (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes3)cla;global yy;global z1;global ba1;global aa1;m4=fft(z1);plot(z1,y);title(IIR滤波后的信号波形);xlabel(时间/t);ylabel(幅值);axes(handles.axes4)cla;plot(abs(m4),y);title(IIR滤波后信号频谱);xlabel(频率/HZ);ylabel(幅值);% - Executes on button press in tag_gaobo.function tag_gaobo_Callback(hObject, eventdata, handles)% hObject handle to tag_gaobo (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes3)cla;global yy;global z2;global B3;global ba3;global aa3;m5=fft(z2);plot(z2,y);title(IIR滤波后的信号波形);xlabel(时间/t);ylabel(幅值);axes(handles.axes4)cla;plot(abs(m5),y);title(IIR滤波后信号频谱);xlabel(频率/HZ);ylabel(幅值);% - Executes on button press in tag_daibo.function tag_daibo_Callback(hObject, eventdata, handles)% hObject handle to tag_daibo (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes3)cla;global yy;global z3;global B2;global ba2;global aa2;m6=fft(z3);plot(z3,y);title(IIR滤波后的信号波形);xlabel(时间/t);ylabel(幅值);axes(handles.axes4)cla;plot(abs(m6),y);title(IIR滤波后信号频谱);xlabel(频率/HZ);ylabel(幅值); % - Executes on selection change in tag_choose.function tag_choose_Callback(hObject, eventdata, handles)% hObject handle to tag_choose (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,String) returns tag_choose contents as cell array% contentsget(hObject,Value) returns selected item from tag_choose % - Executes during object creation, after setting all properties.function tag_choose_CreateFcn(hObject, eventdata, handles)% hObject handle to tag_choose (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,BackgroundColor,white);else set(hObject,BackgroundColor,get(0,defaultUicontrolBackgroundColor);end % - Executes on button press in tag_return.function tag_return_Callback(hObject, event
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- Unit 7 At the Restaurant Lesson Lesson 2 Do you like fruit(教学设计)-2023-2024学年北师大版(三起)英语四年级下册
- 中国防反溢地漏行业市场前景预测及投资价值评估分析报告
- 2025校招:算法开发工程师试题及答案
- 中国陶瓷泥浆泵行业市场前景预测及投资价值评估分析报告
- 第4课《孙权劝学》教学设计-2024-2025学年统编版语文七年级下册
- 2025校招:氢能源系统笔试题及答案
- 2025校招:BMS软件工程师面试题及答案
- 2025销售经理秋招笔试题及答案
- 公务员面试盒饭面试题及答案
- 公务员面试光头面试题及答案
- 信息安全自查管理办法
- DG-TJ08-2144-2025 公路养护工程质量检验评定标准
- 心肌梗死患者的护理诊断与护理措施
- 统编教材初中语文单元人文主题和语文要素梳理
- 备战高一高二高三高考历史临考题号押题-押第19题中国现代化(解析版)
- 初中女生生理健康讲座
- 2025年农业科技人员职称考试题及答案
- 违章建筑培训课件
- 宠物户外营地活动方案
- 期货课件培训
- 工厂行车吊装方案(3篇)
评论
0/150
提交评论