Signal filtering

Hi :) I'd like to know how to divide a signal into frames (for example 25 ms frames) without overlapping. And how do I multiply each frame using the Hamming window?
Thanks!

 채택된 답변

Wayne King
Wayne King 2011년 12월 2일

0 개 추천

Hi Anna, If you're using reshape you can't change the number of elements. so
x = randn(10,1);
x1 = reshape(x,5,2);
is ok, but
x1 = reshape(x,6,2);
is not.
Yes, you can use buffer to overlap your signal segments.
Note that buffer() will prepend and append zeros as necessary:
x = 1:10;
x1 = buffer(x,5,2);

댓글 수: 1

Anna
Anna 2011년 12월 2일
It wooooooooooooooorks. Thank youuuuu. You're so awesome! :D

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

추가 답변 (1개)

Wayne King
Wayne King 2011년 10월 20일

0 개 추천

You have to know your sampling rate in order to know how many samples a 25-ms frame is. Here I'll assume it's 10 kHz. So 250 samples is 25 msec and there are 40 such segments in 1 second.
x = randn(1e4,1);
x = reshape(x,250,40);
ham = repmat(hamming(250),1,40);
x = x.*ham;
Each column of x is a 25 msec segment multiplied by a Hamming window.

댓글 수: 2

Jan
Jan 2011년 10월 20일
I expect that "x = bsxfun(@times, x, hamming(250));" is faster than creating ham explicitely.
Anna
Anna 2011년 12월 2일
How come when I try to add in an audio signal (using wavread) and I try to reshape it, (I used 16kHz for Fs), an 'Error' shows up. It says that it should have the same number of elements.
And is it also possible to use buffer in the circumstance that I need to overlap?
Thank You!

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

카테고리

질문:

2011년 10월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by