hanning ,hamming window in matlab?
23 次查看(过去 30 天)
显示 更早的评论
how do Hanning and Hamming window in matlab?
when must I do these window after DFT signal or before DFT signal?
0 个评论
采纳的回答
Wayne King
2013-11-26
编辑:Wayne King
2013-11-26
Before you take the DFT
hamming() or hann()
t = 0:0.001:1-0.00;
x = cos(2*pi*100*t)+randn(size(t));
winvec = hamming(length(x)); % hann(length(x));
xdft = fft(x'.*winvec);
plot(abs(xdft))
6 个评论
Wayne King
2013-11-26
You can put them in a matrix and multiply them all at once.
X = randn(100,20);
h = hamming(100);
h = repmat(h,1,20);
X = X.*h;
更多回答(2 个)
Wayne King
2013-11-27
编辑:Wayne King
2013-11-27
That depends on how they are in your workspace. If you have 20 separate vectors, then just do this.
I'll assume they are column vectors and I'll just create 3 signals here.
s1 = randn(33,1);
s2 = randn(33,1);
s3 = randn(33,1);
Sig = [s1 s2 s3];
Now window them as before:
h = hamming(33);
Sig = Sig.*repmat(h,1,3);
Now take the DFT
SigDFT = fft(Sig);
Obviously, you have to make adjustments for the 20 columns above:
repmat(h,1,20)
for example
Wayne King
2013-11-27
If you have row vectors you have to make the necessary adjustment. Just convert them to column vectors.
s1 = s1';
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hamming 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!