Thread Subject: window

Subject: window

From: astro mmi

Date: 22 Nov, 2009 18:03:01

Message: 1 of 3

for i=1:200:length(unvoiced)
ham20=hamming(200); %hamming window of duration 20ms(20ms*1000Hz=200samples)
unvoiced20=unvoiced(i:i+199).*ham20;
end

Hello everyone,
 In the above code, I am trying to window a given sequence framebyframe i.e, I am considering that there are 72 windowing operations. The unvoiced20 should be a sequenceof 14400 samples but only 200 samples are generated.AM I performing windowing the rightway.Pls help.Thanx.

Subject: window

From: Jan Simon

Date: 22 Nov, 2009 18:38:00

Message: 2 of 3

Dear astro mmi!

> for i=1:200:length(unvoiced)
> ham20=hamming(200); %hamming window of duration 20ms(20ms*1000Hz=200samples)
> unvoiced20=unvoiced(i:i+199).*ham20;
> end
>
> Hello everyone,
> In the above code, I am trying to window a given sequence framebyframe i.e, I am considering that there are 72 windowing operations. The unvoiced20 should be a sequenceof 14400 samples but only 200 samples are generated.

Use the debugger and set a break point in the line:
  unvoiced20=unvoiced(i:i+199).*ham20;
There you will find, that the variable unvoiced20 is overwritten in each step of the for loop.
I assume, you want to append the vectors:

unvoiced20 = zeros(1, length(unvoiced)); % EVER preallocate
 for i=1:200:length(unvoiced)
    ham20 = hamming(200);
    unvoiced20(i:i+199) = unvoiced(i:i+199).*ham20;
 end

But ham20 is a scalar and the multiplication does not need a loop at all?!
  unvoiced20 = unvoiced .* hamming(200);
Perhaps you mean:
  ham20 = hamming(1:200); ?!
Than a matrix-multiplication would be much more efficient.

Kind regards, Jan

Subject: window

From: astro mmi

Date: 22 Nov, 2009 20:44:03

Message: 3 of 3

Thank you for the help. Now I got what I needed.

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hec0e8$rf7$1@fred.mathworks.com>...
> Dear astro mmi!
>
> > for i=1:200:length(unvoiced)
> > ham20=hamming(200); %hamming window of duration 20ms(20ms*1000Hz=200samples)
> > unvoiced20=unvoiced(i:i+199).*ham20;
> > end
> >
> > Hello everyone,
> > In the above code, I am trying to window a given sequence framebyframe i.e, I am considering that there are 72 windowing operations. The unvoiced20 should be a sequenceof 14400 samples but only 200 samples are generated.
>
> Use the debugger and set a break point in the line:
> unvoiced20=unvoiced(i:i+199).*ham20;
> There you will find, that the variable unvoiced20 is overwritten in each step of the for loop.
> I assume, you want to append the vectors:
>
> unvoiced20 = zeros(1, length(unvoiced)); % EVER preallocate
> for i=1:200:length(unvoiced)
> ham20 = hamming(200);
> unvoiced20(i:i+199) = unvoiced(i:i+199).*ham20;
> end
>
> But ham20 is a scalar and the multiplication does not need a loop at all?!
> unvoiced20 = unvoiced .* hamming(200);
> Perhaps you mean:
> ham20 = hamming(1:200); ?!
> Than a matrix-multiplication would be much more efficient.
>
> Kind regards, Jan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
framebyframe astro mmi 22 Nov, 2009 13:04:07
window astro mmi 22 Nov, 2009 13:04:06
rssFeed for this Thread

Contact us at files@mathworks.com