声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3095|回复: 5

[共享资源] MATLAB 在数字信号中的应用

[复制链接]
发表于 2006-6-27 20:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
<P  align=center><B>摘要:</B><FONT size=3>录制一段个人的语音信号,并对录制的信号进行采样;画出采样后语音信号的时域波形和频谱图;给定滤波器的性能指标,采用窗函数法和双线性变换设计滤波器,并画出滤波器的频率响应;然后用自己设计的滤波器对采集的信号进行滤波,画出滤波后信号的时域波形和频谱,并对滤波前后的信号进行对比,分析信号的变化;回放语音信号;最后,设计一个信号处理系统界面。</FONT></P>
<P ><p><FONT face="Times New Roman"> </FONT></p></P>
<P ><p><FONT face="Times New Roman"> </FONT></p></P>
<P ><p><FONT face="Times New Roman"> </FONT></p></P>
<P ><p><FONT face="Times New Roman"> </FONT></p></P>
<P ><p><FONT face="Times New Roman"> </FONT></p></P>
<P ><B>目录</B><B><FONT face="Times New Roman"> </FONT></B><B>:</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">1.    </FONT></B><B>摘要</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">1.1</FONT></B><B>题目</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">1.2</FONT></B><B>摘要说明</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">1.3</FONT></B><B>对</B><B><FONT face="Times New Roman">MATLAB</FONT></B><B>的认识</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.    </FONT></B><B>正文</B><B><p></p></B></P>
<P ><FONT face="Times New Roman"><B>  </B><B>2.1</B></FONT><B>实验内容</B><B><FONT face="Times New Roman">                   <p></p></FONT></B></P>
<P ><B><FONT face="Times New Roman">2.1.1</FONT></B><B>语音信号的采集和滤波器性能指标</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.1.2 </FONT></B><B>根据低通滤波器性能指标设计低通滤波器</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.1.3 </FONT></B><B>根据高通滤波器性能指标设计高通滤波器</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.1.4 </FONT></B><B>根据带通滤波器性能指标设计带通滤波器</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.1.5</FONT></B><B>用滤波器对语音信号进行滤波并输出波形</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.1.6</FONT></B><B>语音回放</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.1.7</FONT></B><B>设计系统界面</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.2</FONT></B><B>实习结论</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.2.1</FONT></B><B>实习总结</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">2.2.2</FONT></B><B>实习感想与收获</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">3.    </FONT></B><B>谢辞</B><B><p></p></B></P>
<P ><B><FONT face="Times New Roman">4.    </FONT></B><B>参考文献</B><B><p></p></B></P>
<P ><B><p><FONT face="Times New Roman"> </FONT></p></B></P>
<P ><B><p><FONT face="Times New Roman"> </FONT></p></B></P>
<P >1.<FONT face="Times New Roman"> </FONT>绪论<p></p></P>
<P ><FONT size=3>本报告采用“录制采集语音信号;对录制的信号进行采样;绘制采样后语音信号的时域波形和频谱图;设计滤波器,并画出滤波器的频率响应;运用所设计的滤波器对采集的信号进行滤波,绘制滤波后信号的时域波形和频谱,设计一个信号处理系统界面。”的先后顺序的顺序设计思路编写的。<p></p></FONT></P>
<P >2.语音信号的采集。<p></p></P>
<P ><FONT size=3>利用<FONT face="Times New Roman">windows</FONT>自带的录音机,录制一段语音,时间在<FONT face="Times New Roman">1s</FONT>以内。然后在<FONT face="Times New Roman">matlab</FONT>平台下,利用函数<FONT face="Times New Roman">wavread</FONT>对语音信号进行采样。通过<FONT face="Times New Roman">wavread</FONT>函数的使用,理解采样频率,采样位数。其程序如下:</FONT></P>
<P ><FONT face="Times New Roman" size=3>[y,fs,bits]=wavread('e:\wcl.wav',[1024 63500]);</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">sound(y,fs,bits);<p></p></FONT></FONT></P>
<P >3.语音信号的频谱分析<p></p></P>
<P ><FONT size=3>利用<FONT face="Times New Roman">MATLAB</FONT>首先画出语音信号的时域波形;然后对语音进行快速傅立叶变换,得到信号的频谱特性,从而加强对频谱特性的理解。</FONT></P>
<P ><FONT size=3>其程序如下:</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Y=fft(y,4096);<p></p></FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">figure(1);<p></p></FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">plot(y);title('</FONT>语音信号的时域波形<FONT face="Times New Roman">');<p></p></FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">figure(2);<p></p></FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">freqz(Y);title('</FONT>语音信号的频普特性<FONT face="Times New Roman">');<p></p></FONT></FONT></P>
<P ><FONT size=3>运行图形为:</FONT></P>
<P ><v:shapetype><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path connecttype="rect" gradientshapeok="t" extrusionok="f"></v:path><lock aspectratio="t" v:ext="edit"></lock></v:shapetype><v:shape><v:imagedata><FONT size=3></FONT></v:imagedata></v:shape><v:shape><v:imagedata><FONT size=3></FONT></v:imagedata></v:shape></P>
<P >4.设计数字滤波器和画出其频率响应<p></p></P>
<P ><FONT size=3>给定各滤波器的性能指标如下:</FONT></P>
<P ><FONT size=3>低通滤波器性能指标<FONT face="Times New Roman">   fb=1000Hz</FONT>,<FONT face="Times New Roman">fc</FONT>=<FONT face="Times New Roman">1200Hz</FONT>,<FONT face="Times New Roman"> As</FONT>=<FONT face="Times New Roman">100db</FONT>,<FONT face="Times New Roman">Ap</FONT>=<FONT face="Times New Roman">1db</FONT>。</FONT></P>
<P ><FONT size=3>高通滤波器性能指标<FONT face="Times New Roman">   fs</FONT>=<FONT face="Times New Roman">4800Hz</FONT>,<FONT face="Times New Roman">fb</FONT>=<FONT face="Times New Roman">5000Hz</FONT>,<FONT face="Times New Roman">As</FONT>=<FONT face="Times New Roman">100db</FONT>,<FONT face="Times New Roman">Ap</FONT>=<FONT face="Times New Roman">1db</FONT>。</FONT></P>
<P ><FONT size=3>带通滤波器性能指标<FONT face="Times New Roman">   fb1</FONT>=<FONT face="Times New Roman">1200Hz</FONT>,<FONT face="Times New Roman">fb2</FONT>=<FONT face="Times New Roman">3000Hz</FONT>,<FONT face="Times New Roman">fc1</FONT>=<FONT face="Times New Roman">1000Hz</FONT>,<FONT face="Times New Roman">fc2</FONT>=<FONT face="Times New Roman">3200Hz</FONT>,<FONT face="Times New Roman">As</FONT>=<FONT face="Times New Roman">100db</FONT>,<FONT face="Times New Roman">Ap</FONT>=<FONT face="Times New Roman">1db</FONT>。</FONT></P>
<P >4.1双线性变换法设计低通滤波器<p></p></P>
<P ><FONT face="Times New Roman" size=3>clear;close all;</FONT></P>
<P ><FONT face="Times New Roman" size=3>[y,fs,bits]=wavread('e:\wcl.wav',[1024 63500]);</FONT></P>
<P ><FONT face="Times New Roman" size=3>sound(y,fs,bits);</FONT></P>
<P ><FONT face="Times New Roman" size=3>Y=fft(y,4096);</FONT></P>
<P ><FONT face="Times New Roman" size=3>fb=1000;fc=1200;As=100;Ap=1;fs=22050;</FONT></P>
<P ><FONT face="Times New Roman" size=3>wc=2*fc/fs; wb=2*fb/fs;</FONT></P>
<P ><FONT face="Times New Roman" size=3>[n,wn]=ellipord(wc,wb,Ap,As);</FONT></P>
<P ><FONT face="Times New Roman" size=3>[b,a]=ellip(n,Ap,As,wn);</FONT></P>
<P ><FONT face="Times New Roman" size=3>figure(1);</FONT></P>
<P ><FONT face="Times New Roman" size=3>freqz(b,a,512,fs);</FONT></P>
<P ><FONT face="Times New Roman" size=3>x=filter(b,a,y);</FONT></P>
<P ><FONT face="Times New Roman" size=3>X=fft(x,4096);</FONT></P>
<P ><FONT face="Times New Roman" size=3>figure(2);</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,1);plot(y);title('</FONT>滤波前信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,2);plot(Y);title('</FONT>滤波前信号频谱<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2, 2 ,3);plot(x);title('</FONT>滤波后信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2, 2 ,4);plot(abs(X));title('</FONT>滤波后信号频谱<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT face="Times New Roman" size=3>sound(x,fs,bits);</FONT></P>
<P ><FONT size=3>其运行图形如下图:</FONT></P>
<P ><v:shape><v:imagedata><FONT size=3></FONT></v:imagedata></v:shape></P>
<P >4.2用双线性变换法设计高通滤波器<p></p></P>
<P ><FONT face="Times New Roman" size=3>clear;close all</FONT></P>
<P ><FONT face="Times New Roman" size=3>[y,fs,bits]=wavread('e:\wcl.wav',[1024 63500]);</FONT></P>
<P ><FONT face="Times New Roman" size=3>sound(y,fs,bits);</FONT></P>
<P ><FONT face="Times New Roman" size=3>Y=fft(y,4096);</FONT></P>
<P ><FONT face="Times New Roman" size=3>fs=4800,fb=5000,As=100,Ap=1,fc=22050;</FONT></P>
<P ><FONT face="Times New Roman" size=3>ws=2*fs/fc;wb=2*fb/fc;</FONT></P>
<P ><FONT face="Times New Roman" size=3>[n,wn]=ellipord(ws,wb,Ap,As);</FONT></P>
<P ><FONT face="Times New Roman" size=3>[b,a]=ellip(n,Ap,As,wn);</FONT></P>
<P ><FONT face="Times New Roman" size=3>figure(1);</FONT></P>
<P ><FONT face="Times New Roman" size=3>freqz(b,a,fc);</FONT></P>
<P ><FONT face="Times New Roman" size=3>x=filter(b,a,y);</FONT></P>
<P ><FONT face="Times New Roman" size=3>X=fft(x,4096);</FONT></P>
<P ><FONT face="Times New Roman" size=3>figure(2);</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,1);plot(y);title('</FONT>滤波前信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,2);plot(Y);title('</FONT>滤波前信号频谱<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2, 2 ,3);plot(x);title('</FONT>滤波后信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2, 2 ,4);plot(abs(X));title('</FONT>滤波后信号频谱<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT face="Times New Roman" size=3>sound(x,fs,bits);</FONT></P>
<P ><FONT size=3>其运行图形如下图:</FONT></P>
<P ><p><FONT face="Times New Roman" size=3> </FONT></p></P>
<P ><v:shape><v:imagedata><FONT face="Times New Roman" size=3></FONT></v:imagedata></v:shape><p></p></P>
<P >4.3 用双线性变换法设计带通滤波器设计<p></p></P>
<P ><FONT face="Times New Roman" size=3>clear;close all</FONT></P>
<P ><FONT face="Times New Roman" size=3>[y,fs,bits]=wavread('e:\wcl.wav',[1024 63500]);</FONT></P>
<P ><FONT face="Times New Roman" size=3>sound(y,fs,bits);</FONT></P>
<P ><FONT face="Times New Roman" size=3>Y=fft(y,4096);</FONT></P>
<P ><FONT face="Times New Roman" size=3>fb1=1200;fb2=3000;fc1=1000;fc2=3200;fs=22050;</FONT></P>
<P ><FONT face="Times New Roman" size=3>W1=2*fb1/fs;W2=2*fc1/fs;</FONT></P>
<P ><FONT face="Times New Roman" size=3>W3=2*fb2/fs;W4=2*fc2/fs;</FONT></P>
<P ><FONT face="Times New Roman" size=3>Wp=[W1,W3];</FONT></P>
<P ><FONT face="Times New Roman" size=3>Ws=[W2,W4];</FONT></P>
<P ><FONT face="Times New Roman" size=3>Rp=1;</FONT></P>
<P ><FONT face="Times New Roman" size=3>Rs=100;</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">[N,wc]=ellipord(Wp,Ws,Rp,Rs)             </FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">[b,a]=ellip(N,Rp,Rs,wc)     </FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">[hw,w]=freqz(b,a);                       </FONT></FONT></P>
<P ><FONT face="Times New Roman" size=3>x=filter(b,a,y);</FONT></P>
<P ><FONT face="Times New Roman" size=3>X=fft(x,4096);</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,1);plot(y);title('</FONT>滤波前信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,2);plot(Y);title('</FONT>滤波前信号频谱<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2, 2 ,3);plot(x);title('</FONT>滤波后信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2, 2 ,4);plot(abs(X));title('</FONT>滤波后信号频谱<FONT face="Times New Roman">'); sound(x,fs,bits);</FONT></FONT></P>
<P ><FONT size=3>其运行图形如下图:</FONT></P>
<P ><p><FONT face="Times New Roman" size=3> </FONT></p></P>
<P ><p><FONT face="Times New Roman"> </FONT></p></P>
<P ><v:shape><v:imagedata><FONT face="Times New Roman"></FONT></v:imagedata></v:shape></P>
<P >5. 用滤波器对信号进行滤波。 <p></p></P>
<P ><FONT size=3>用自己设计的各滤波器分别对采集的信号进行滤波,在<FONT face="Times New Roman">matlab</FONT>中,<FONT face="Times New Roman">FIR</FONT>滤波器利用函数<FONT face="Times New Roman">fftfilt</FONT>对信号进行滤波,<FONT face="Times New Roman">IIR</FONT>滤波器利用函数<FONT face="Times New Roman">filter</FONT>对信号进行滤波。<p></p></FONT></P>
<P >6.<FONT face="Times New Roman"> </FONT>比较滤波前后语音信号的波形及频谱。<p></p></P>
<P ><FONT size=3>在一个窗口同时画出滤波前后的波形及频谱。</FONT></P>
<P ><FONT size=3>其程序如下:</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">x</FONT>=<FONT face="Times New Roman">filter</FONT>(<FONT face="Times New Roman">b</FONT>,<FONT face="Times New Roman">a</FONT>,<FONT face="Times New Roman">y</FONT>)<FONT face="Times New Roman">;</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">X</FONT>=<FONT face="Times New Roman">fft(x,4096);</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,1);plot(y);title('</FONT>滤波前信号波形<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">subplot(2,2,2);plot(Y);title('</FONT>滤波前信号频谱<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2 2 3);plot(x);title(‘</FONT>滤波后信号波形<FONT face="Times New Roman">’);</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Subplot(2 2 4);plot(abs(X));title(‘</FONT>滤波后信号频谱<FONT face="Times New Roman">’); </FONT></FONT></P>
<P ><FONT size=3>其运行图形如下图:</FONT></P>
<P >7.<FONT face="Times New Roman"> </FONT>回放语音信号。<p></p></P>
<P ><FONT size=3>在<FONT face="Times New Roman">matlab</FONT>中,函数<FONT face="Times New Roman">sound</FONT>可以对声音进行回放。其调用格式:<FONT face="Times New Roman">sound</FONT>(<FONT face="Times New Roman">x</FONT>,<FONT face="Times New Roman">fs</FONT>,<FONT face="Times New Roman">bits</FONT>);可以感觉滤波前后的声音有变化。程序为:<FONT face="Times New Roman">sound(x,fs,bits);<p></p></FONT></FONT></P>
<P >8.设计系统界面<p></p></P>
<P ><FONT size=3>为了使编制的程序操作方便,设计处理系统的用户界面。在设计的系统界面上可以选择滤波器的类型,输入滤波器的参数,显示滤波器的频率响应。</FONT></P>
<P ><FONT size=3>主程序如(<FONT face="Times New Roman">main.m</FONT>)下:</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">alternation=menu('</FONT>请选择滤波器<FONT face="Times New Roman">','</FONT>低通滤波器<FONT face="Times New Roman">','</FONT>带通滤波器<FONT face="Times New Roman">','</FONT>高通滤波器<FONT face="Times New Roman">','</FONT>退出<FONT face="Times New Roman">');</FONT></FONT></P>
<P ><FONT face="Times New Roman" size=3>switch alternation</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">    case 1,low; main;</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">    case 2,band; main;</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">    case 3,high; main;</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">    case 4,break</FONT>;</FONT></P>
<P ><FONT face="Times New Roman" size=3>end</FONT></P>
<P ><FONT size=3>运行如右图:</FONT><v:shape><FONT size=3><FONT face="Times New Roman"> <v:imagedata></v:imagedata></FONT></FONT></v:shape><FONT face="Times New Roman" size=3>       </FONT></P>
<P >
<P ><FONT size=3></FONT></P><p><FONT face="Times New Roman" size=3> </FONT></p></P>
回复
分享到:

使用道具 举报

发表于 2006-7-16 19:06 | 显示全部楼层
不错啊,谢谢
发表于 2006-7-18 09:18 | 显示全部楼层
嗯,不错
发表于 2006-8-2 22:20 | 显示全部楼层
非常好
谢谢了
发表于 2006-8-3 13:25 | 显示全部楼层
太好了,楼主,能把你的这篇实习全文共享以下吗?
smallkin@126.com
发表于 2013-4-23 14:28 | 显示全部楼层
恩,不错
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-17 19:25 , Processed in 0.063201 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表