1 / 26

第九节 信号处理工具箱

第九节 信号处理工具箱. 1. 波形产生. 1.sin 正弦波 格式 : x= sin(t) 例: t=0:0.001:1;y=sin(2*pi*t);plot(y) z=sin(2*pi*10*t);plot(z) 设信号的采样频率为 F ,信号的自变量通常取为 t= 0:1/F:n , n 表示信号的时间长度为 n 秒。 则 sin(2*pi*t) 即为频率为 1 的正弦波, sin(2*pi*f*t) 即为频率为 f 的正弦波. 1. 波形产生. 2. sawtooth 锯齿波或三角波

idania
Download Presentation

第九节 信号处理工具箱

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第九节 信号处理工具箱

  2. 1. 波形产生 1.sin 正弦波 格式: x= sin(t) 例:t=0:0.001:1;y=sin(2*pi*t);plot(y) z=sin(2*pi*10*t);plot(z) 设信号的采样频率为F,信号的自变量通常取为t= 0:1/F:n ,n表示信号的时间长度为n秒。 则sin(2*pi*t)即为频率为1的正弦波, sin(2*pi*f*t)即为频率为f的正弦波

  3. 1. 波形产生 2. sawtooth 锯齿波或三角波 格式: x= sawtooth(t)  sawtooth(t,1) x= sawtooth(t,width) 3. square 方波 格式: x= square(t)  square(t,50) x= square(t,duty) 4.sinc 产生sinc或sin(pi*t)/(pi*t) 函数 格式: x= sinc(t) 5. diric 产生Dirichlet 或周期sinc函数 格式: x= diric(t,n)

  4. 2. 变换 1.fft 一维快速傅立叶变换,用于计算离散傅立叶变换 格式: y=fft(x) y=fft(x,n) 采用n点FFT 例: t=0:0.001:1; x=sin(2*pi*50*t)+ sin(2*pi*120*t); y=x+1.5*randn(1,length(t)); Y=fft(y,512); P=Y.*conj(Y)/512; %计算功率谱密度 f=1000*(0:255)/512; plot(f,P(1:256))

  5. 2. 变换 2.ifft 一维逆快速傅立叶变换(IFFT) 格式: y=ifft(x) y=ifft(x,n) 3.hilbert 希尔伯特变换 格式: y= hilbert(x) 4.czt 线形调频Z变换, 格式: y= czt(x,m,w,a) y=czt(x) 计算x沿着由w和a定义的螺旋周线上的Z变换,指定变换长度,w指定沿着z平面螺旋周线上的点之间的比率(即倾斜率),a指定起始点

  6. 3. 统计信号处理 1.cov 协方差矩阵 格式: c=cov(x) 当x为矢量时,cov(x)可求出矢量x的方差(标量) 当x为矩阵时,cov(x)可得到协方差矩阵 而diag(conv(x))则为由每列数据的方差所构成的矢量

  7. 3. 统计信号处理 2.xcov 互协方差(自协方差)函数估计 格式: v=xcov(x,y) v=xcov(x) 3.xcorr 互相关(自相关)函数估计 格式: v=xcorr(x,y) v=xcorr(x)

  8. 4. 窗函数 1.矩形窗 w=boxcar(n) 2.三角窗 w=triang(n) 3.巴特利特窗 w=bartlett(n) 4.汉明窗 w=hamming(n) 5.汉宁窗 w=hanning(n) 6.布莱克曼窗 w=blackman(n) 7.切比雪夫窗 w=chebwin(n,r) 8.凯泽窗 w=kaiser(n,beta)

  9. 5. 滤波 IIR滤波器结构:

  10. 5. 滤波 M阶IIR滤波器: 差分方程表达式:

  11. 5. 滤波 FIR滤波器结构:

  12. 5. 滤波 M阶FIR滤波器: 差分方程表达式:

  13. 5. 滤波 1.filter 利用递归滤波器(IIR)或非递归滤波器(FIR)对数据进行数字滤波 格式: y=filter(b,a,x) b,a为滤波器系数,x为待滤波的数据 2.fftfilt 利用基于FFT的重叠相加法对数据进行滤波,只适用于非递归滤波器(FIR) 格式: y=fftfilt(b,x)

  14. 5. 滤波 3.freqz 数字滤波器的频率响应 格式: [h,w]=freqz(b,a) freqz(b,a,n) freqz(b,a,w) 4.freqs 模拟滤波器的频率响应 格式: [h,w]= freqs(b,a) freqs(b,a,n) freqs(b,a,w)

  15. 6. IIR滤波器设计 1.besself 贝塞尔模拟滤波器设计 [b,a]=besself(n,Wn) n阶截止频率Wn的低通模拟滤波器 [b,a]=besself(n,[W1 W2]) W1<W2 2n阶带通模拟滤波器 [b,a]=besself(n,Wn,’high’) n阶截止频率Wn的高通模拟滤波器 [b,a]=besself(n,[W1 W2],’stop’) W1<W2 2n阶带阻模拟滤波器

  16. 6. IIR滤波器设计 2.butter 比特沃思模拟和数字滤波器设计 [b,a]=butter(n,Wn) 0<=Wn<=1 n阶截止频率Wn的低通数字滤波器 [b,a]=butter(n,[W1 W2]) W1<W2 2n阶带通数字滤波器 [b,a]=butter(n,Wn,’high’) Wn=1相当于fs/2 n阶截止频率Wn的高通数字滤波器 [b,a]=butter(n,[W1 W2],’stop’) W1<W2 2n阶带阻数字滤波器 [b,a]=butter(n,Wn,’high’,’s’) n阶截止频率Wn的高通模拟滤波器

  17. 6. IIR滤波器设计 例: t=0:0.001:1; x=sin(t*2*pi*200)+sin(t*2*pi); [b,a]=butter(10,0.2);figure(1);freqz(b,a) y=filter(b,a,x);figure(2) subplot(2,1,1);plot(x) subplot(2,1,2);plot(y)

  18. 6. IIR滤波器设计 3.yulewalk 递归数字滤波器设计 格式: [b,a]=yulewalk(n,f,m) f为频率点,m为相应的响应幅度 例:f=[0 0.6 0.65 0.7 1]; m=[1 1 0.5 0 0]; [b,a]= yulewalk(8,f,m) ; [h,w]= freqz(b,a,128); plot(f,m,w/pi,abs(h),'--')

  19. 7. FIR滤波器设计 1.fir1 基于窗函数的FIR滤波器设计——标准频率响应 b=fir1(n,Wn) 0<=Wn<=1, Wn=1相当于fs/2 n阶截止频率Wn的加汉明Hamming窗线形相位低通FIR滤波器 b=fir1(n,[W1 W2],’stop’) W1<W2 2n阶带阻模拟滤波器 b=fir1(n,Wn,Window) Window长度为n+1 采用向量Window中指定的窗函数进行设计的滤波器

  20. 7. FIR滤波器设计 例: W=chebwin(35,30); b=fir1(34,0.48,'high',W); freqz(b,1,512);

  21. 7. FIR滤波器设计 2.fir2 基于窗函数的FIR滤波器设计——任意标准频率响应 b=fir2(n,f,m) b=fir2(n,f,m,Window) 其中: f为频率点, m为相应的响应幅度, Window为指定的窗函数

  22. 7. FIR滤波器设计 例:f=[0 0.6 0.6 1]; m=[1 1 0 0]; b= fir2(30,f,m); [h,w]= freqz(b,1,128); figure(1);plot(f,m,w/pi,abs(h),’--’) t=0:0.001:1; x=sin(t*2*pi*350)+sin(t*2*pi*10); y=fftfilt(b,x);figure(2) subplot(2,1,1);plot(x) subplot(2,1,2);plot(y)

  23. 7. FIR滤波器设计 3.firls 最小二乘线形相位FIR滤波器设计 b=firls(n,f,m) 3.remez 最优FIR滤波器设计 b= remez(n,f,m)

  24. 8. 其他 1.medfilt1 一维中值滤波 y= medfilt1(x,n)

  25. 8. 其他 2.interp 提高采样速率(内插) y= interp(x,r) 结果:y的长度是x的r倍 3.decimate 降低采样速率(内插) y= decimate(x,r) 结果:y的长度是x的1/r

  26. 8. 其他 例: t=0:0.00025:1; x=sin(2*pi*30*t)+sin(2*pi*60*t); y= decimate(x,4); subplot(2,1,1);stem(x(1:120)); subplot(2,1,2);stem(y (1:30)); …

More Related