Matlab数字信号处理实验报告.doc_第1页
Matlab数字信号处理实验报告.doc_第2页
Matlab数字信号处理实验报告.doc_第3页
Matlab数字信号处理实验报告.doc_第4页
Matlab数字信号处理实验报告.doc_第5页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

数字信号处理实验报告基础实验篇实验一 离散时间系统及离散卷积一、 实验原理 利用matlab软件计算出系统函数的零极点分布、单位脉冲响应和系统频率响应等的图像并于笔算结果进行比较,找出异同。编译合适程序能计算取值范围不同的离散卷积。二、 实验目的(1)熟悉matlab软件的使用方法。(2)熟悉系统函数的零极点分布、单位脉冲响应和系统频率响应等概念。(3)利用matlab绘制系统函数的零极点分布图、系统频率响应和单位脉冲响应。三、实验步骤(1)自编并调试实验程序,并且,给实验程序加注释;(2)按照实验内容完成笔算结果;(3)验证计算程序的正确性,记录实验结果。(4)至少要求一个除参考实例以外的实验结果,在实验报告中,要描述清楚实验结果对应的系统,并对实验结果进行解释说明。四、实验源程序及实验结果实验1-1运行结果xlabel(n);ylabel(h(n);figure(2)z,p,g=tf2zp(b,a);zplane(z,p)title(零极点);function x,n=chongji(n1,n2)n=n1:n2;x=n=0;function shiyan1()a=1,-1,0.9;b=1;x=chongji(-20,120);n=-20:120;h=filter(b,a,x);figure(1)stem(n,h);title(冲击响应);实验1-2运行结果b=0.0181,0.0543,0.0543,0.0181; a=1.000,-1.76,1.1829,-0.2781;w=pi*freqspace(500);h=freqz(b,a,w);mh=abs(h);ah=angle(h);subplot(2,1,1);plot(w/pi,mh);grid;axis(0,1,0,1);xlabel(w(pi);ylabel(|h|);title(幅度、相位响应);subplot(2,1,2);plot(w/pi,ah);grid;xlabel(w(pi);ylabel(angle(h);实验1-3运行结果n=0:30;%输入x(n)和冲激响应h(n) x=zeros(1,length(n);h=zeros(1,length(n);x(find(n=0)&(n=0)&(n=0)&(n=0)&(n=8)=0.5;subplot(3,1,1);stem(x);title(x(n);axis(0,30,0,2);subplot(3,1,2);stem(h);title(h(n);axis(0,30,0,2);x=fft(x);h=fft(h);y=x.*h;y=ifft(y);subplot(3,1,3);stem(abs(y);title(y(n);实验三 iir数字滤波器设计一、 实验原理(1)脉冲响应不变法 用数字滤波器的单位脉冲响应序列模仿模拟滤波器的冲激响应,让正好等于的采样值,即 其中t为采样间隔,如果以及分别表示的拉氏变换及的z变换,则 (2) 双线性变换法 s平面与z平面之间满足以下映射关系:s平面的虚轴单值地映射于z平面的单位圆上,s平面的左半平面完全映射到z平面的单位圆内。双线性变换不存在混叠问题。双线性变换时一种非线性变换 ,这种非线性引起的幅频特性畸变可通过预畸而得到校正。以低通数字滤波器为例,将设计步骤归纳如下:1. 确定数字滤波器的性能指标:通带临界频率fp、阻带临界频率fs;通带内的最大衰减rp;阻带内的最小衰减as;采样周期t; 2. 确定相应的数字角频率,p=2fpt;s=2frt; 3. 计算经过预畸的相应模拟低通原型的频率, 根据p和s计算模拟低通原型滤波器的阶数n,并求得低通原型的传递函数ha(s);4. 用上面的双线性变换公式代入ha(s),求出所设计的传递函数h(z); 5. 分析滤波器特性,检查其指标是否满足要求。 二、 实验目的1、 学习模拟数字变换滤波器的设计方法;2、 掌握双线性变换数字滤波器设计方法;3、 掌握实现数字滤波器的具体方法。三、实验步骤1、 设计一个巴特沃思数字低通滤波器,设计指标如下:通带内幅度衰减不大于1db;阻带幅度衰减不小于15db;2、 编制计算设计的数字滤波器幅度特性和相位特性的程序,并进行实验验证。3、 编制实现该数字滤波器程序并且实现数字滤波(1) 分别让满足所设计的滤波器的通带、过渡带、阻带频率特性的正弦波通过滤波器,验证滤波器性能;(2) 改变正弦抽样时间,验证数字低通滤波器的模拟截止频率实抽样时间的函数。 四、实验源程序及结果实验3-1function shiyan3()fp=200*pi;fs=300*pi;wp=0.2*pi;ws=0.3*pi;rp=1;as=15;t=1;fs=1000;n,fc=buttord(fp,fs,rp,as,s);b,a=butter(n,fc,s);w=0:1000*2*pi;hf,w=freqs(b,a,1000);d,c=impinvar(b,a,fs);wd=0:512*pi/512;hw1=freqz(d,c,wd);f,e=bilinear(b,a,fs);hw2=freqz(f,e,wd);omegap=(2/t)*tan(wp/2);omegas=(2/t)*tan(ws/2);ep=sqrt(10(rp/10)-1);ripple=sqrt(1/(1+ep.2);attn=1/10(as/20);subplot(3,1,1);plot(wd/pi,abs(hw1)/abs(hw1(1);title(幅度响应(冲击响应不变法);xlabel(w(pi);ylabel(h);运行结果ylabel(h);axis(0,1,0,1.1);set(gca,xtickmode,manual,xtick,0,0.2,0.35,1.1);set(gca,ytickmode,manual,ytick,0,attn,ripple,1);grid;subplot(3,1,2);plot(wd/pi,20*log10(abs(hw2)+eps)/abs(hw2(1);title(幅度响应(双线性变换法(db);xlabel(w(pi);ylabel(h);axis(0,1,-40,5);set(gca,xtickmode,manual,xtick,0,0.2,0.35,1.1);set(gca,ytickmode,manual,ytick,-50,-15,-1,0);grid;subplot(3,1,3);plot(wd/pi,-angle(hw2);title(相位响应);xlabel(w(pi);ylabel(pi unit);%axis(0,1,0,1.1);set(gca,xtickmode,manual,xtick,0,0.2,0.35,1.1);set(gca,ytickmode,manual,ytick,-1,0,1);grid;实验四 fir数字滤波器设计一、 实验原理窗函数法设计线性相位fir滤波器步骤 确定数字滤波器的性能要求:临界频率k,滤波器单位脉冲响应长度n; 根据性能要求,合理选择单位脉冲响应的奇偶对称性,从而确定理想频率响应的幅频特性和相频特性; 求理想单位脉冲响应,在实际计算中,可对按m(m远大于n)点等距离采样,并对其求idft得,用代替; 选择适当的窗函数,根据求所需设计的fir滤波器单位脉冲响应; 求,分析其幅频特性,若不满足要求,可适当改变窗函数形式或长度n,重复上述设计过程,以得到满意的结果。 窗函数的傅式变换的主瓣决定了过渡带宽。的旁瓣大小和多少决定了在通带和阻带范围内波动幅度,常用的几种窗函数有: 矩形窗 w(n)=rn(n) hanning窗 hamming窗 blackmen窗 kaiser窗 式中io(x)为零阶贝塞尔函数。二、实验目的1、 学习fir数字滤波器窗口函数设计法;2、 熟悉线性相位fir滤波器的幅频特性和相频特性;3、 了解各种不同窗函数对滤波器性能的影响4、 进行fir、iir滤波器的性能比较。三、实验步骤1、 设计一个fir数字滤波器,设计指标如下:通带内幅度衰减不大于1db;阻带幅度衰减不小于15db;2、 编制计算设计的数字滤波器幅度特性和相位特性的程序,并进行实验验证。3、 分别用矩形窗、汉宁窗、海明窗、三角窗和blackman窗设计一的线性相位带通滤波器,观察它们的3db和20db带宽,并比较五种窗的特点。四、实验源程序及运行结果实验3-1function shiyan4()%41 fir filterwp=0.2*pi;ws=0.3*pi;tr_width=ws-wp;m=ceil(6.6*pi/tr_width)+1;n=0:m-1;wc=(ws+wp)/2;alpha=(m-1)/2;m=n-alpha+eps;hd=sin(wc*m)./(pi*m);w_ham=(hamming(m);% h=hd.*w_ham;%加汉明窗% h=hd;%加矩形窗h=hd.*(blackman(m);%加布莱克曼窗mag,db,pha,w=freqz_m(h,1);delta_w=2*pi/1000;rp=-(min(db(1:wp/delta_w+1);as=-round(max(db(ws/delta_w+1:501);subplot(2,2,1);stem(n,hd);title(理想冲激响应);axis(0,m-1,-0.1,0.3);ylabel(hd(n);subplot(2,2,2);stem(n,h);title(实际冲激响应);axis(0,m-1,-0.1,0.3);ylabel(h(n);subplot(2,2,3);plot(w/pi,pha);title(滤波器相位响应);axis(0,1,-pi,pi);运行结果ylabel(pha);set(gca,xtickmode,manual,xtick,0,0.2,0.3,1.1);set(gca,ytickmode,manual,ytick,-pi,0,pi);grid;subplot(2,2,4);plot(w/pi,db);title(滤波器幅度响应);axis(0,1,-100,10);ylabel(h(db);set(gca,xtickmode,manual,xtick,0,0.2,0.3,1.1);set(gca,ytickmode,manual,ytick,-50,-15,0);function mag,db,pha,w=freqz_m(b,a)h,w=freqz(b,a,1000,whole);h=(h(1:501);w=(w(1:501);mag=abs(h);db=20*log10(mag+eps)/max(mag);pha=angle(h); 加矩形窗加汉明窗加布莱克曼窗综合试验篇一、实验目的借助基础实验篇编制的程序,对语音信号进行处理。通过综合实验篇,使得学生能够充分了解信号处理及数字信号处理的过程;使得学生能够对自己设计的频谱分析程序与滤波器程序得到灵活的应用;使得学生能够综合分析信号处理过程各个阶段信号时域与频域特性。二、实验内容1、录制一段各人自己的语音信号。2、对录制的信号进行采样;画出采样后语音信号的时域波形和频谱图;3、给定滤波器的性能指标,采用窗函数法或双线性变换设计滤波器,并画出滤波器的频率响三、实验要求1、完成实验内容要求的各项内容。写明设计思路及其设计原理;2、给出matlab代码,并给编制的程序加注释;3、给出仿真测试结果并对测试结果进行分析;4、对设计成果做出评价,说明本设计的特点和存在问题,提出改进设计意见 ;四、实验源程序及结果(0,1,-pi,pi);function varargout = untitled1(varargin)% untitled1 m-file for untitled1.fig% untitled1, by itself, creates a new untitled1 or raises the existing% singleton*.% h = untitled1 returns the handle to a new untitled1 or the handle to% the existing singleton*.% untitled1(callback,hobject,eventdata,handles,.) calls the local% function named callback in untitled1.m with the given input arguments.% untitled1(property,value,.) creates a new untitled1 or raises the% existing singleton*. starting from the left, property value pairs are% applied to the gui before untitled1_openingfunction gets called. an% unrecognized property name or invalid value makes property application% stop. all inputs are passed to untitled1_openingfcn via varargin.% *see gui options on guides tools menu. choose gui allows only one% instance to run (singleton).% see also: guide, guidata, guihandles % edit the above text to modify the response to help untitled1 % last modified by guide v2.5 24-oct-2012 22:23:01 % begin initialization code - do not editgui_singleton = 1;gui_state = struct(gui_name, mfilename, . gui_singleton, gui_singleton, . gui_openingfcn, untitled1_openingfcn, . gui_outputfcn, untitled1_outputfcn, . gui_layoutfcn, , . gui_callback, );if nargin & isstr(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 untitled1 is made visible.function untitled1_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 untitled1 (see varargin) % choose default command line output for untitled1handles.output = hobject; % update handles structureguidata(hobject, handles); % uiwait makes untitled1 wait for user response (see uiresume)% uiwait(handles.figure1); % - outputs from this function are returned to the command line.function varargout = untitled1_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 pushbutton1.function pushbutton1_callback(hobject, eventdata, handles)z1= wavread(d:wei.wav);plot(z1);sound(z1);% 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) % - executes on button press in pushbutton2.function pushbutton2_callback(hobject, eventdata, handles)z1=wavread(d:wei.wav);y1=z1(1:8192);y1=fft(y1);n=0:8191;plot(n,y1);% hobject handle to pushbutton2 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata) % - executes on button press in pushbutton3.function pushbutton3_callback(hobject, eventdata, handles)clear;global fp;global fc;z1,fs,bits=wavread(d:wei.wav)y1=z1(1:8192);y1=fft(y1);as=100;ap=1;fs=8000;wc=2*atan(fc/(2*fs); wp=2*atan(fp/(2*fs);wdel=wc-wp;beta=0.112*(as-8.7);n=ceil(as-8)/2.285/wdel);wn= kaiser(n+1,beta); ws=(wp+wc)/2/pi;b=fir1(n,ws,wn); figure(1);freqz(b,1);x=fftfilt(b,z1);x=fft(x,8192); figure(2);subplot(2,2,1);plot(abs(y1);% axis(0,1000,0,1.0);title();subplot(2,2,2);plot(abs(x);% axis(0,1000,0,1.0);title();subplot(2,2,3);plot(z1);title();subplot(2,2,4);plot(x);title();sound(x,fs,bits);% 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) % - 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 structure with handles and user data (see guidata) % - executes during object creation, after setting all properties.function edit1_createfcn(hobject, eventdata, handles)% hobject handle to edit1 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles empty - handles not created until after all createfcns called % hint: edit 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 function edit1_callback(hobject, eventdata, handles)global fp;get(hobject,string);fp=str2num(get(hobject,string);% hobject handle to edit1 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata) % hints: get(hobject,string) returns contents of edit1 as text% str2double(get(hobject,string) returns contents of edit1 as a double % - executes during object creation, after setting all properties.function edit2_createfcn(hobject, eventdata, handles)% hobject handle to edit2 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles empty - handles not created until after all createfcns called % hint: edit 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 function edit2_callback(hobject, eventdata, handles)global fc;get(hobject,string);fc=str2num(get(hobject,string);% hobject handle to edit2 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata) % hints: get(hobject,string) returns contents of edit2 as text% str2double(get(hobject,string) returns contents of edit2 as a double提高实验篇一、实验目的借助数字信号处理课程中的快速傅立叶反变换(ifft)和快速傅立叶变换(fft)相关知识,实现基带ofdm系统的调制和解调。二、实验内容1、信号源:首先产生二进制信号,经星座映射为4psk或16qam。2、ofdm调制:借助ifft变换,实现ofdm调制。3、信道模块。ofdm信号通过该模块到达接收端。4、ofdm解调:借助fft对信道输出信号进行ofdm解调。5、对ofdm解调得到的信号进行星座反映射,还原二进制信号。初始化:子载波数为256,出入不同信噪比进行误码率统计16-qam解调fft去掉循环前缀加入高斯白噪声加入循环前缀ifft16-qam调制产生随机数开始结束三、实验流程图四、实验原理框图符号定时频偏校正输入数据信道编码交织信号映射插入导频串/并交换ifft并/串变换插保护间隔载波调制信道载波解调去保护间隔串/并变换fft并/串变换信道估计信道逆映射解交织信道解码输出数据定时和频率同步五、实验源程序及运行结果close all;clc;snr=input(请你输入信号经信道时的信噪比snr(以dbw为单位):);n=256;%n为载波数,即一个ofdm符号的长度for k=1:n x(k)=fix(rand()*16);%随机产生256个0,15之间的整数 x1(k)=qam16_mod(x(k);%进行星座图映射,x 可以认为是已经进行串/并转换后的输出信号endfigure(1)plot(real(x1),imag(x1),xr);title(随机输入数据的星座图);xlabel(an(实部));ylabel(bn(虚部));x2=ifft(x1,n);%对x进行傅里叶反变换x3=x2(n-0.25*n+1):n),x2;%在该ofd

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论