exa031101_fftfilt.m
来自「离散时间信号的傅立叶变换的各个例子的算法」· M 代码 · 共 20 行
M
20 行
%----------------------------------------------------------------------------
% exa031001_fftfilt.m, for example 3.11.1
% to test fftfilt.m,and to finish the convolution of a long sequence with
% a short sequence by DFT.
%----------------------------------------------------------------------------
clear;
% 用叠接相加法,计算滤波器系数h和输入信号x的卷积
% 其中h为10阶hanning窗,x是带有高斯白噪的正弦信号
h=fir1(10,0.3,hanning(11));% h: a short sequence ; h is the impulse response
N=500;p=0.05;f=1/16; % of a low-pass filter.
u=randn(1,N)*sqrt(p); % u:white noise
s=sin(2*pi*f*[0:N-1]); % s:sine signal
x=u(1:N)+s; % x: a long sequence;
y=fftfilt(h,x); % y=x*h
subplot(211)
plot(x);
subplot(212)
plot(y);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?