how do Hanning and Hamming window in matlab?
when must I do these window after DFT signal or before DFT signal?

 채택된 답변

Wayne King
Wayne King 2013년 11월 26일
편집: Wayne King 2013년 11월 26일

1 개 추천

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

Mary Jon
Mary Jon 2013년 11월 26일
t = 0:0.001:1-0.00; no problem if length of my signal is 33?
Mary Jon
Mary Jon 2013년 11월 26일
instead of x in your code, I will put my signal?is not it?
Wayne King
Wayne King 2013년 11월 26일
yes, I just did an example. Substitute your signal as desired.
Mary Jon
Mary Jon 2013년 11월 26일
if I have 20 signals ,what I do , repeated this code 20 times
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;
Mary Jon
Mary Jon 2013년 11월 26일
편집: Mary Jon 2013년 11월 26일
How put 20 signals with length 33 in matrix? s1=first signal, s2=second signal,and so on and where is DFT in your code?

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Wayne King
Wayne King 2013년 11월 27일
편집: Wayne King 2013년 11월 27일

1 개 추천

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

댓글 수: 1

Mary Jon
Mary Jon 2013년 11월 27일
I have row vectors not column vectors, s1=[1 2 3 4] s2=[3 5 6 6] and so on
when applied yor code in to my signals I get this error
Error using ==> times Matrix dimensions must agree.

댓글을 달려면 로그인하십시오.

Wayne King
Wayne King 2013년 11월 27일

1 개 추천

If you have row vectors you have to make the necessary adjustment. Just convert them to column vectors.
s1 = s1';

댓글 수: 3

Mary Jon
Mary Jon 2013년 11월 27일
if I want to plot each signal of SigDFT individually How do that? because of when I plot (SigDFT)signals, I get not clear plot or shape
You should plot abs()
plot(abs(SigDFT))
Mary Jon
Mary Jon 2013년 11월 27일
Thank you so much for every thing,Wayne

댓글을 달려면 로그인하십시오.

카테고리

제품

질문:

2013년 11월 26일

댓글:

2013년 11월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by