%% 窗函数
clc;
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
X = 0.7*sin(2*pi*50*t)+ 0.9*cos(2*pi*90*t)+rand(4,1500);%如果要看到窗函数的作用,数据在每个通道内必须有大于两帧的长度
win = dsp.Window
win.WindowFunction='Hamming';
win.WeightsOutputPort=true;
win.StopbandAttenuation=50;%仅当Chebyshev型窗函数时有效,数值越大,带宽越窄
win.Beta=10;%仅当Kaiser型窗函数时有效
win.NumConstantSidelobes=4;%仅当Taylor型窗函数时有效
win.MaximumSidelobeLevel=-30;%仅当Taylor型窗函数时有效
win.Sampling='Symmetric';%仅当Blackman;Hamming;Hann;Hanning型窗函数时有效
%用法
[Y,W] = win(X);
wvtool(W)%可以查看窗函数的工具
subplot(2,1,1)
plot(t,X)
subplot(2,1,2)
plot(t,Y)
通常如果不加窗函数,就是默认为矩形窗。
ω ( n ) = 1 \displaystyle \omega (n)=1 ω(n)=1
ω ( n ) = e − 1 2 ( n − ( N − 1 ) / 2 σ ( N − 1 ) / 2 ) 2 σ ≤ 0.5 \displaystyle \begin{array}{l}\omega (n)={{e}^{{-\frac{1}{2}{{{(\frac{{n-(N-1)/2}} {{\sigma (N-1)/2}})}}^{2}}}}}\\\sigma \le 0.5\end{array} ω(n)=e−21(σ(N−1)/2n−(N−1)/2)2σ≤0.5
ω ( n ) = a 0 − ( 1 − a 0 ) ⋅ cos ( 2 π n N − 1 ) , 0 ≤ n ≤ N − 1 , a 0 = 0.53836 H a m m i n g , a 0 = 0.5 H a n n \displaystyle \begin{array}{l}\omega (n)={{a}_{0}}-(1-{{a}_{0}})\cdot \cos (\frac{{2\pi n}}{{N-1}}),0\le n\le N-1,\\{{a}_{0}}=0.53836Hamming,{{a}_{0}}=0.5Hann\end{array} ω(n)=a0−(1−a0)⋅cos(N−12πn),0≤n≤N−1,a0=0.53836Hamming,a0=0.5Hann
ω ( n ) = 2 N − 1 ⋅ ( N − 1 2 − ∣ n − N − 1 2 ∣ ) \displaystyle \omega (n)=\frac{2}{{N-1}}\cdot (\frac{{N-1}}{2}-|n-\frac{{N-1}}{2}|) ω(n)=N−12⋅(2N−1−∣n−2N−1∣)
ω ( n ) = 2 N ⋅ ( N 2 − ∣ n − N − 1 2 ∣ ) \displaystyle \omega (n)=\frac{2}{N}\cdot (\frac{N}{2}-|n-\frac{{N-1}}{2}|) ω(n)=N2⋅(2N−∣n−2N−1∣)
ω ( n ) = a 0 − a 1 cos ( 2 π n N − 1 ) + a 2 cos ( 4 π n N − 1 ) , a 0 = 0.42 , a 1 = 0.5 , a 2 = 0.08 \displaystyle \omega (n)={{a}_{0}}-{{a}_{1}}\cos (\frac{{2\pi n}}{{N-1}})+{{a}_{2}}\cos (\frac{{4\pi n}}{{N-1}}),{{a}_{0}}=0.42,{{a}_{1}}=0.5,{{a}_{2}}=0.08 ω(n)=a0−a1cos(N−12πn)+a2cos(N−14πn),a0=0.42,a1=0.5,a2=0.08
ω ( n ) = I 0 ( π a 1 − ( 2 n N − 1 − 1 ) 2 ) I 0 ( π a ) \displaystyle \omega (n)=\frac{{{{I}_{0}}(\pi a\sqrt{{1-{{{(\frac{{2n}}{{N-1}}-1)}}^{2}}}})}}{{{{I}_{0}}(\pi a)}} ω(n)=I0(πa)I0(πa1−(N−12n−1)2)
参考资料
Copyright © 2020 by RichardYang. All rights reserved.
仅供参考,严禁转载,感谢。