Program_2_4.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % Program_2_4
- % Signal Smoothing by Moving Average Filter
- %
- clf;
- R = 51;
- d = rand(R,1)-0.5;
- for m = 1:1:R;
- s(m) = 2*(m-1)*((0.9)^(m-1));
- x(m) = s(m) + d(m);
- end
- M = input('Length of moving average filter = ');
- k = 0:R-1;
- subplot(2,1,1)
- plot(k,d,'g-',k,s,'b--',k,x,'r-');
- axis([0 50 -2 8]);
- xlabel('Time index n'); ylabel('Amplitude');
- legend('d[n]','s[n]','x[n]');
- subplot(2,1,2)
- b = ones(M,1)/M;
- a = 1;
- y = filter(b,a,x);
- plot(k,s,'b--',k,y,'r-');
- axis([0 50 -2 8]);
- xlabel('Time index n'); ylabel('Amplitude');
- legend('s[n]','y[n]');