Calculate FFT in blocks and then average it.

  • Follow


Hi guys,
I have a very basic problem. I am able to calculate FFT of an input vector.


But now what i want is,  to subdivide the input vector  into blocks, each
having equal number of elements.  An FFT needs to be performed on each
individual block.  The results of these FFTs are then averaged to give the
final result.  

How to accomplish this ? Please pour in. 




0
Reply raj 8/10/2010 12:27:40 PM

On 8/10/2010 8:27 AM, raj malhotra wrote:
> Hi guys,
> I have a very basic problem. I am able to calculate FFT of an input vector.
>
>
> But now what i want is,  to subdivide the input vector  into blocks, each
> having equal number of elements.  An FFT needs to be performed on each
> individual block.  The results of these FFTs are then averaged to give the
> final result.
>
> How to accomplish this ? Please pour in.

It's really simple.

1) Divide the input data into blocks of equal size. (Did the word 
"vector" confuse you?) Discard any leftover samples. Window each block 
separately.

2) Perform FFTs on each of the blocks.

3) Since all relative phase information is lost by creating the blocks, 
compute the magnitudes of the bins.

4) Add like bins from each of the FFTs. Optionally, divide by the number 
of blocks.

In other words, do what you wrote.

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply Jerry 8/10/2010 12:57:15 PM


On Aug 10, 8:57=A0am, Jerry Avins <j...@ieee.org> wrote:
> On 8/10/2010 8:27 AM, raj malhotra wrote:
>
> > Hi guys,
> > I have a very basic problem. I am able to calculate FFT of an input vec=
tor.
>
> > But now what i want is, =A0to subdivide the input vector =A0into blocks=
, each
> > having equal number of elements. =A0An FFT needs to be performed on eac=
h
> > individual block. =A0The results of these FFTs are then averaged to giv=
e the
> > final result.
>
> > How to accomplish this ? Please pour in.
>
> It's really simple.
>
> 1) Divide the input data into blocks of equal size. (Did the word
> "vector" confuse you?) Discard any leftover samples. Window each block
> separately.
>
> 2) Perform FFTs on each of the blocks.
>
> 3) Since all relative phase information is lost by creating the blocks,
> compute the magnitudes of the bins.
>
> 4) Add like bins from each of the FFTs. Optionally, divide by the number
> of blocks.
>
> In other words, do what you wrote.
>

he *might* want to average the squares of the magnitudes (before
square rooting).  but, unless he has specific information about the
signal period, he does need to toss the phase information.

r b-j

0
Reply robert 8/10/2010 2:27:59 PM

On Aug 10, 5:57=A0am, Jerry Avins <j...@ieee.org> wrote:
> 3) Since all relative phase information is lost by creating the blocks,
> compute the magnitudes of the bins.

If you know the block offsets, then relative phase information
isn't lost.  This allows options such as coherent averaging
for narrower bin-centered filtering, or interpolation of more
bins or frequencies between blocks using phase vocoder
methods.


IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M
 http://www.nicholson.com/rhn/dsp.html
0
Reply rhnlogic (1111) 8/10/2010 6:58:10 PM

On 8/10/2010 2:58 PM, Ron N. wrote:
> On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org>  wrote:
>> 3) Since all relative phase information is lost by creating the blocks,
>> compute the magnitudes of the bins.
>
> If you know the block offsets, then relative phase information
> isn't lost.  This allows options such as coherent averaging
> for narrower bin-centered filtering, or interpolation of more
> bins or frequencies between blocks using phase vocoder
> methods.

Do you suppose that anyone who asked the original question could manage 
to do that?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply Jerry 8/10/2010 7:54:18 PM

On Aug 10, 3:54=A0pm, Jerry Avins <j...@ieee.org> wrote:
> On 8/10/2010 2:58 PM, Ron N. wrote:
>
> > On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org> =A0wrote:
> >> 3) Since all relative phase information is lost by creating the blocks=
,
> >> compute the magnitudes of the bins.
>
> > If you know the block offsets, then relative phase information
> > isn't lost. =A0This allows options such as coherent averaging
> > for narrower bin-centered filtering, or interpolation of more
> > bins or frequencies between blocks using phase vocoder
> > methods.
>
> Do you suppose that anyone who asked the original question could manage
> to do that?

well, Ron's right (and i missed it too).  you have to add (or
subtract) a linear phase term (same as rotating the complex value)
with slope proportional to the known block offset.  i think then you
have to do the averaging to the complex values of each bin.

r b-j

0
Reply robert 8/10/2010 8:31:15 PM

On 8/10/2010 4:31 PM, robert bristow-johnson wrote:
> On Aug 10, 3:54 pm, Jerry Avins<j...@ieee.org>  wrote:
>> On 8/10/2010 2:58 PM, Ron N. wrote:
>>
>>> On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org>    wrote:
>>>> 3) Since all relative phase information is lost by creating the blocks,
>>>> compute the magnitudes of the bins.
>>
>>> If you know the block offsets, then relative phase information
>>> isn't lost.  This allows options such as coherent averaging
>>> for narrower bin-centered filtering, or interpolation of more
>>> bins or frequencies between blocks using phase vocoder
>>> methods.
>>
>> Do you suppose that anyone who asked the original question could manage
>> to do that?
>
> well, Ron's right (and i missed it too).  you have to add (or
> subtract) a linear phase term (same as rotating the complex value)
> with slope proportional to the known block offset.  i think then you
> have to do the averaging to the complex values of each bin.

Not have to, but can. Of course Ron is right. Just remember: the OP 
asked, among other things, how to divide his "vector" into equal-sized 
"blocks". Do you imagine that he could have phase aligned the 
transformed blocks without more instruction than he could follow?

I've been helping bewbies for a long time. I must have written about my 
second-grade classmate who began to whimper during the lunch period, but 
it's worth repeating here.

Going home for lunch had been permitted when we were in first grade. The 
rule changed when we got to second grade and everyone had to bring lunch 
to school, even my classmate who lived across the street. (It was a 
local side street, but his mother didn't allow him to cross it alone.) 
About the second week of school, the guy began to whimper quietly while 
we we still in the gym where we gathered to eat. I noticed and asked him 
what was wrong. He said pitifully, "I have to go to the bathroom." I was 
puzzled. The door to the boy's room was in plain sight. He said "My 
mommy has to wipe me." I offered to show him how do to that himself, and 
all was well.

The next day, his mother met him as usual at the gate of the schoolyard 
to guide him across the street*, but the two of them were just standing 
there when I came out. He had evidently pointed me out to her, because 
she addressed me when I approached. I assumed I was in for a scolding, 
but I was wrong. She thanked me warmly for caring for and educating her 
little darling. Despite being an articulate kid, I probably wouldn't 
have been able to express what I thought of her parenting skills even 
had I wanted to. I said only, "You could have showed him yourself if you 
wanted him to know." Her son was merely ignorant. She was dumb.

Jerry
______________________________
* At that age, I would go alone by bus and subway to the Museum of 
Natural History to spend the day. My parents gave me half a dollar for 
the day; $.20 for four fares, $.25 for lunch in the cafeteria, and a 
nickle just so. (Usually a candy bar.)
-- 
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
0
Reply Jerry 8/10/2010 10:34:11 PM

>On 8/10/2010 4:31 PM, robert bristow-johnson wrote:
>> On Aug 10, 3:54 pm, Jerry Avins<j...@ieee.org>  wrote:
>>> On 8/10/2010 2:58 PM, Ron N. wrote:
>>>
>>>> On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org>    wrote:
>>>>> 3) Since all relative phase information is lost by creating the
blocks,
>>>>> compute the magnitudes of the bins.
>>>
>>>> If you know the block offsets, then relative phase information
>>>> isn't lost.  This allows options such as coherent averaging
>>>> for narrower bin-centered filtering, or interpolation of more
>>>> bins or frequencies between blocks using phase vocoder
>>>> methods.
>>>
>>> Do you suppose that anyone who asked the original question could
manage
>>> to do that?
>>
>> well, Ron's right (and i missed it too).  you have to add (or
>> subtract) a linear phase term (same as rotating the complex value)
>> with slope proportional to the known block offset.  i think then you
>> have to do the averaging to the complex values of each bin.
>
>Not have to, but can. Of course Ron is right. Just remember: the OP 
>asked, among other things, how to divide his "vector" into equal-sized 
>"blocks". Do you imagine that he could have phase aligned the 
>transformed blocks without more instruction than he could follow?
>
>I've been helping bewbies for a long time. I must have written about my 
>second-grade classmate who began to whimper during the lunch period, but 
>it's worth repeating here.
>
>Going home for lunch had been permitted when we were in first grade. The 
>rule changed when we got to second grade and everyone had to bring lunch 
>to school, even my classmate who lived across the street. (It was a 
>local side street, but his mother didn't allow him to cross it alone.) 
>About the second week of school, the guy began to whimper quietly while 
>we we still in the gym where we gathered to eat. I noticed and asked him 
>what was wrong. He said pitifully, "I have to go to the bathroom." I was 
>puzzled. The door to the boy's room was in plain sight. He said "My 
>mommy has to wipe me." I offered to show him how do to that himself, and 
>all was well.
>
>The next day, his mother met him as usual at the gate of the schoolyard 
>to guide him across the street*, but the two of them were just standing 
>there when I came out. He had evidently pointed me out to her, because 
>she addressed me when I approached. I assumed I was in for a scolding, 
>but I was wrong. She thanked me warmly for caring for and educating her 
>little darling. Despite being an articulate kid, I probably wouldn't 
>have been able to express what I thought of her parenting skills even 
>had I wanted to. I said only, "You could have showed him yourself if you 
>wanted him to know." Her son was merely ignorant. She was dumb.
>
>Jerry
>______________________________
>* At that age, I would go alone by bus and subway to the Museum of 
>Natural History to spend the day. My parents gave me half a dollar for 
>the day; $.20 for four fares, $.25 for lunch in the cafeteria, and a 
>nickle just so. (Usually a candy bar.)
>-- 
>Engineering is the art of making what you want from things you can get.
>�����������������������������������������������������������������������


Hi guys,
I started this ques, but sorry i didn't checked the posts. I should clear
you that i am not facing a problem in "dividing the input vector" in equal
sizes and neither i am confused with the word "vector". lolest!! This ,
even the kid whom you helped ,would have done. 
See, i want that each block should have block size as a power of two. So,
if the user enter block size as 3, my code will take it 4, likewise if
block size is given by user as 13, my code will take it 16. This i have
accomplished by : 

block_size = 1 << (long)ceil(log((double)block_size)/log(2.0));

Now, let say, i enter block_size=6, overlap=1 and no. of elemnts=18  (from
1 to 18) . Than my code will make three blocks of block_size =8 each. 1st
block has elements from 1 to 8. 2nd block has elements from 8 to 15 (since
overlap is 1). third block has elements as block3[0]=15 (since overlap is
1), block3[1]=16, block3[2]=17, block3[3]=18. Now, i can fill anything or
lets say zero in block3[4] to block3[7]. 

Applied FFTW on each block, and now i am averaging it in this way(of what i
am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
arr2, arr3. Final output after averaging is in "output" array. So i did
this,
output[0]= (arr1[0]+arr2[0]+arr3[0])/3;  till output[3].
this is how i calculated.
And for output[4]=(arr1[4]+arr2[4]); till output[7].

The result i am getting is not satisfactory. I will be grateful if you guys
could pour in. 

Thanks & Regards,
Raj.


0
Reply f2007327 (3) 8/17/2010 10:25:43 AM

>>On 8/10/2010 4:31 PM, robert bristow-johnson wrote:
>>> On Aug 10, 3:54 pm, Jerry Avins<j...@ieee.org>  wrote:
>>>> On 8/10/2010 2:58 PM, Ron N. wrote:
>>>>
>>>>> On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org>    wrote:
>>>>>> 3) Since all relative phase information is lost by creating the
>blocks,
>>>>>> compute the magnitudes of the bins.
>>>>
>>>>> If you know the block offsets, then relative phase information
>>>>> isn't lost.  This allows options such as coherent averaging
>>>>> for narrower bin-centered filtering, or interpolation of more
>>>>> bins or frequencies between blocks using phase vocoder
>>>>> methods.
>>>>
>>>> Do you suppose that anyone who asked the original question could
>manage
>>>> to do that?
>>>
>>> well, Ron's right (and i missed it too).  you have to add (or
>>> subtract) a linear phase term (same as rotating the complex value)
>>> with slope proportional to the known block offset.  i think then you
>>> have to do the averaging to the complex values of each bin.
>>
>>Not have to, but can. Of course Ron is right. Just remember: the OP 
>>asked, among other things, how to divide his "vector" into equal-sized 
>>"blocks". Do you imagine that he could have phase aligned the 
>>transformed blocks without more instruction than he could follow?
>>
>>I've been helping bewbies for a long time. I must have written about my 
>>second-grade classmate who began to whimper during the lunch period, but

>>it's worth repeating here.
>>
>>Going home for lunch had been permitted when we were in first grade. The

>>rule changed when we got to second grade and everyone had to bring lunch

>>to school, even my classmate who lived across the street. (It was a 
>>local side street, but his mother didn't allow him to cross it alone.) 
>>About the second week of school, the guy began to whimper quietly while 
>>we we still in the gym where we gathered to eat. I noticed and asked him

>>what was wrong. He said pitifully, "I have to go to the bathroom." I was

>>puzzled. The door to the boy's room was in plain sight. He said "My 
>>mommy has to wipe me." I offered to show him how do to that himself, and

>>all was well.
>>
>>The next day, his mother met him as usual at the gate of the schoolyard 
>>to guide him across the street*, but the two of them were just standing 
>>there when I came out. He had evidently pointed me out to her, because 
>>she addressed me when I approached. I assumed I was in for a scolding, 
>>but I was wrong. She thanked me warmly for caring for and educating her 
>>little darling. Despite being an articulate kid, I probably wouldn't 
>>have been able to express what I thought of her parenting skills even 
>>had I wanted to. I said only, "You could have showed him yourself if you

>>wanted him to know." Her son was merely ignorant. She was dumb.
>>
>>Jerry
>>______________________________
>>* At that age, I would go alone by bus and subway to the Museum of 
>>Natural History to spend the day. My parents gave me half a dollar for 
>>the day; $.20 for four fares, $.25 for lunch in the cafeteria, and a 
>>nickle just so. (Usually a candy bar.)
>>-- 
>>Engineering is the art of making what you want from things you can get.
>>�����������������������������������������������������������������������
>
>
>Hi guys,
>I started this ques, but sorry i didn't checked the posts. I should clear
>you that i am not facing a problem in "dividing the input vector" in
equal
>sizes and neither i am confused with the word "vector". lolest!! This ,
>even the kid whom you helped ,would have done. 
>See, i want that each block should have block size as a power of two. So,
>if the user enter block size as 3, my code will take it 4, likewise if
>block size is given by user as 13, my code will take it 16. This i have
>accomplished by : 
>
>block_size = 1 << (long)ceil(log((double)block_size)/log(2.0));
>
>Now, let say, i enter block_size=6, overlap=1 and no. of elemnts=18 
(from
>1 to 18) . Than my code will make three blocks of block_size =8 each. 1st
>block has elements from 1 to 8. 2nd block has elements from 8 to 15
(since
>overlap is 1). third block has elements as block3[0]=15 (since overlap is
>1), block3[1]=16, block3[2]=17, block3[3]=18. Now, i can fill anything or
>lets say zero in block3[4] to block3[7]. 
>
>Applied FFTW on each block, and now i am averaging it in this way(of what
i
>am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
>arr2, arr3. Final output after averaging is in "output" array. So i did
>this,
>output[0]= (arr1[0]+arr2[0]+arr3[0])/3;  till output[3].
>this is how i calculated.
>And for output[4]=(arr1[4]+arr2[4]); till output[7].
>
>The result i am getting is not satisfactory. I will be grateful if you
guys
>could pour in. 
>
>Thanks & Regards,
>Raj.
>
>
  Sorry, its is :  output[4]=(arr1[4]+arr2[4])/2; till output[7]
0
Reply f2007327 (3) 8/17/2010 10:35:50 AM

>>>On 8/10/2010 4:31 PM, robert bristow-johnson wrote:
>>>> On Aug 10, 3:54 pm, Jerry Avins<j...@ieee.org>  wrote:
>>>>> On 8/10/2010 2:58 PM, Ron N. wrote:
>>>>>
>>>>>> On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org>    wrote:
>>>>>>> 3) Since all relative phase information is lost by creating the
>>blocks,
>>>>>>> compute the magnitudes of the bins.
>>>>>
>>>>>> If you know the block offsets, then relative phase information
>>>>>> isn't lost.  This allows options such as coherent averaging
>>>>>> for narrower bin-centered filtering, or interpolation of more
>>>>>> bins or frequencies between blocks using phase vocoder
>>>>>> methods.
>>>>>
>>>>> Do you suppose that anyone who asked the original question could
>>manage
>>>>> to do that?
>>>>
>>>> well, Ron's right (and i missed it too).  you have to add (or
>>>> subtract) a linear phase term (same as rotating the complex value)
>>>> with slope proportional to the known block offset.  i think then you
>>>> have to do the averaging to the complex values of each bin.
>>>
>>>Not have to, but can. Of course Ron is right. Just remember: the OP 
>>>asked, among other things, how to divide his "vector" into equal-sized 
>>>"blocks". Do you imagine that he could have phase aligned the 
>>>transformed blocks without more instruction than he could follow?
>>>
>>>I've been helping bewbies for a long time. I must have written about my

>>>second-grade classmate who began to whimper during the lunch period,
but
>
>>>it's worth repeating here.
>>>
>>>Going home for lunch had been permitted when we were in first grade.
The
>
>>>rule changed when we got to second grade and everyone had to bring
lunch
>
>>>to school, even my classmate who lived across the street. (It was a 
>>>local side street, but his mother didn't allow him to cross it alone.) 
>>>About the second week of school, the guy began to whimper quietly while

>>>we we still in the gym where we gathered to eat. I noticed and asked
him
>
>>>what was wrong. He said pitifully, "I have to go to the bathroom." I
was
>
>>>puzzled. The door to the boy's room was in plain sight. He said "My 
>>>mommy has to wipe me." I offered to show him how do to that himself,
and
>
>>>all was well.
>>>
>>>The next day, his mother met him as usual at the gate of the schoolyard

>>>to guide him across the street*, but the two of them were just standing

>>>there when I came out. He had evidently pointed me out to her, because 
>>>she addressed me when I approached. I assumed I was in for a scolding, 
>>>but I was wrong. She thanked me warmly for caring for and educating her

>>>little darling. Despite being an articulate kid, I probably wouldn't 
>>>have been able to express what I thought of her parenting skills even 
>>>had I wanted to. I said only, "You could have showed him yourself if
you
>
>>>wanted him to know." Her son was merely ignorant. She was dumb.
>>>
>>>Jerry
>>>______________________________
>>>* At that age, I would go alone by bus and subway to the Museum of 
>>>Natural History to spend the day. My parents gave me half a dollar for 
>>>the day; $.20 for four fares, $.25 for lunch in the cafeteria, and a 
>>>nickle just so. (Usually a candy bar.)
>>>-- 
>>>Engineering is the art of making what you want from things you can get.
>>>�����������������������������������������������������������������������
>>
>>
>>Hi guys,
>>I started this ques, but sorry i didn't checked the posts. I should
clear
>>you that i am not facing a problem in "dividing the input vector" in
>equal
>>sizes and neither i am confused with the word "vector". lolest!! This ,
>>even the kid whom you helped ,would have done. 
>>See, i want that each block should have block size as a power of two.
So,
>>if the user enter block size as 3, my code will take it 4, likewise if
>>block size is given by user as 13, my code will take it 16. This i have
>>accomplished by : 
>>
>>block_size = 1 << (long)ceil(log((double)block_size)/log(2.0));
>>
>>Now, let say, i enter block_size=6, overlap=1 and no. of elemnts=18 
>(from
>>1 to 18) . Than my code will make three blocks of block_size =8 each.
1st
>>block has elements from 1 to 8. 2nd block has elements from 8 to 15
>(since
>>overlap is 1). third block has elements as block3[0]=15 (since overlap
is
>>1), block3[1]=16, block3[2]=17, block3[3]=18. Now, i can fill anything
or
>>lets say zero in block3[4] to block3[7]. 
>>
>>Applied FFTW on each block, and now i am averaging it in this way(of
what
>i
>>am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
>>arr2, arr3. Final output after averaging is in "output" array. So i did
>>this,
>>output[0]= (arr1[0]+arr2[0]+arr3[0])/3;  till output[3].
>>this is how i calculated.
>>And for output[4]=(arr1[4]+arr2[4]); till output[7].
>>
>>The result i am getting is not satisfactory. I will be grateful if you
>guys
>>could pour in. 
>>
>>Thanks & Regards,
>>Raj.
>>
>>
>  Sorry, its is :  output[4]=(arr1[4]+arr2[4])/2; till output[7]




Hi guys,
I started this ques, but sorry i didn't checked the posts. I should clear
you that i am not facing a problem in "dividing the input vector" in
equal sizes and neither i am confused with the word "vector". lolest!! This
,even the kid whom you helped ,would have done. 
See, i want that each block should have block size as a power of two. So,
if the user enter block size as 3, my code will take it 4, likewise if
block size is given by user as 13, my code will take it 16. This i have
accomplished by : 

block_size = 1 << (long)ceil(log((double)block_size)/log(2.0));

Now, let say, i enter block_size=6, overlap=1 and no. of elemnts=18 
(from 1 to 18) . Than my code will make three blocks of block_size =8 each.
1st
block has elements from 1 to 8. 2nd block has elements from 8 to 15
(since overlap is 1). third block has elements as block3[0]=15 (since
overlap is
1), block3[1]=16, block3[2]=17, block3[3]=18. Now, i can fill anything or
lets say zero in block3[4] to block3[7]. 

Applied FFTW on each block, and now i am averaging it in this way(of what
i am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
arr2, arr3. Final output after averaging is in "output" array. So i did
this,
output[0]= (arr1[0]+arr2[0]+arr3[0])/3;  till output[3].
this is how i calculated.
And for output[4]=(arr1[4]+arr2[4])/2; till output[7].

The result i am getting is not satisfactory. I will be grateful if you
guys could pour in. 

Thanks & Regards,
Raj.




0
Reply f2007327 (3) 8/17/2010 10:59:08 AM

Hi guys,
I started this ques, but sorry i didn't checked the posts. I should clear
you that i am not facing a problem in "dividing the input vector" in
equal sizes and neither i am confused with the word "vector". lolest!! This
,even the kid whom you helped ,would have done. 
See, i want that each block should have block size as a power of two. So,
if the user enter block size as 3, my code will take it 4, likewise if
block size is given by user as 13, my code will take it 16. This i have
accomplished by : 

block_size = 1 << (long)ceil(log((double)block_size)/log(2.0));

Now, let say, i enter block_size=6, overlap=1 and no. of elemnts=18 
(from 1 to 18) . Than my code will make three blocks of block_size =8 each.
1st
block has elements from 1 to 8. 2nd block has elements from 8 to 15
(since overlap is 1). third block has elements as block3[0]=15 (since
overlap is
1), block3[1]=16, block3[2]=17, block3[3]=18. Now, i can fill anything or
lets say zero in block3[4] to block3[7]. 

Applied FFTW on each block, and now i am averaging it in this way(of what
i am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
arr2, arr3. Final output after averaging is in "output" array. So i did
this,
output[0]= (arr1[0]+arr2[0]+arr3[0])/3;  till output[3].
this is how i calculated.
And for output[4]=(arr1[4]+arr2[4])/2; till output[7].

The result i am getting is not satisfactory. I will be grateful if you
guys could pour in. 

Thanks & Regards,
Raj.

0
Reply Raj 8/17/2010 11:02:57 AM

On Aug 17, 6:59=A0am, "raj malhotra" <f2007327@n_o_s_p_a_m.bits-
goa.ac.in> wrote:
> >>>On 8/10/2010 4:31 PM, robert bristow-johnson wrote:
> >>>> On Aug 10, 3:54 pm, Jerry Avins<j...@ieee.org> =A0wrote:
> >>>>> On 8/10/2010 2:58 PM, Ron N. wrote:
>
> >>>>>> On Aug 10, 5:57 am, Jerry Avins<j...@ieee.org> =A0 =A0wrote:
> >>>>>>> 3) Since all relative phase information is lost by creating the
> >>blocks,
> >>>>>>> compute the magnitudes of the bins.
>
> >>>>>> If you know the block offsets, then relative phase information
> >>>>>> isn't lost. =A0This allows options such as coherent averaging
> >>>>>> for narrower bin-centered filtering, or interpolation of more
> >>>>>> bins or frequencies between blocks using phase vocoder
> >>>>>> methods.
>
> >>>>> Do you suppose that anyone who asked the original question could
> >>manage
> >>>>> to do that?
>
> >>>> well, Ron's right (and i missed it too). =A0you have to add (or
> >>>> subtract) a linear phase term (same as rotating the complex value)
> >>>> with slope proportional to the known block offset. =A0i think then y=
ou
> >>>> have to do the averaging to the complex values of each bin.
>
> >>>Not have to, but can. Of course Ron is right. Just remember: the OP
> >>>asked, among other things, how to divide his "vector" into equal-sized
> >>>"blocks". Do you imagine that he could have phase aligned the
> >>>transformed blocks without more instruction than he could follow?
>
....
> Applied FFTW on each block, and now i am averaging it in this way(of what
> i am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
> arr2, arr3. Final output after averaging is in "output" array. So i did
> this,
> output[0]=3D (arr1[0]+arr2[0]+arr3[0])/3; =A0till output[3].
> this is how i calculated.
> And for output[4]=3D(arr1[4]+arr2[4])/2; till output[7].

are these complex numbers that you are averaging?

did you understand Ron's post of a week ago?

r b-j
0
Reply rbj (3940) 8/17/2010 2:19:26 PM

raj malhotra wrote:
>Applied FFTW on each block, and now i am averaging it in this way(of what
>i am not sure) : lets say output of 3 fft's are in 3 arrays namely arr1.
>arr2, arr3. Final output after averaging is in "output" array. So i did
>this,
>output[0]= (arr1[0]+arr2[0]+arr3[0])/3;  till output[3].
>this is how i calculated.
>And for output[4]=(arr1[4]+arr2[4])/2; till output[7].


1) So you are assuming that because you zeroed some time domain components,
the corresponding array indicies in the frequency domain can also be
ignored, or did I misunderstand the assumptions there?  If I am
understanding correctly, then that's not how a DFT/FFT works.

2) You mentioned FFTW, but not which transform you applied.  Was it the 1D
r2c?  If so, you may need to look into the way the real and imaginary parts
are stored, and tell us what data type you used there.  Showing the call to
the planner and the execution would probably be good, too.

Michael


0
Reply Michael 8/18/2010 4:07:07 AM

Hi Michael,
Thanks for your prompt reply! 
I have not zeroed the time domain components.Let me re-state:
"input" array divided in 3 arrays (in an example i have taken for 18 elements) ->divided in arrays block1, block2, block3 -> apply fftw (complex 1d transform)->fftw in arrays arr1,arr2,arr3 -> zeroed or ignore the terms in arr3 (i mentioned previously why) ->average the arrays arr1, arr2, arr3 (in a manner i have described previously)->put it in array "output". Remain assured that i am not doing any mistake in using the kind of fftw transform (i'll elaborate you in case you still have doubt what exactly my problem is).
Kindly pour in , if you didn't get my problem , i'll elaborate it nicely by taking a simple example.

Thanks & Regards,
Raj!
0
Reply Raj 8/18/2010 5:31:43 AM

Raj wrote:
>I have not zeroed the time domain components.Let me re-state:
>"input" array divided in 3 arrays (in an example i have taken for 18 
>elements) ->divided in arrays block1, block2, block3 -> apply fftw 
>(complex 1d transform)->fftw in arrays arr1,arr2,arr3 -> zeroed or ignore

>the terms in arr3 (i mentioned previously why) 

Well, you put zeros in block3[4] through block3[7].  I'm not aware of a
problem there.  But I don't see why you can assume arr3[4] through arr3[7]
(arr1-arr3 being outputs of fft) would be zeroed.  The block1-block3 stuff
is time domain, and arr1-arr3 frequency domain, right?  (Even if it's
flipped from that, I think the comment still applies.)


> ->average the arrays arr1, arr2, arr3 (in a manner i have described 
> previously)->put it in array "output". 

Yes, and failing to treat all 8 elements of arr1-arr3 identically (4-7 same
as 0-3) is what struck me as strange, since I can't see why they should be
ignorable or zero.  Maybe run 18 numbers and print all 24 elements of
arr1-arr3?


> Remain assured that i am not doing any mistake in using the kind of fftw

> transform (i'll elaborate you in case you still have doubt what exactly 
> my problem is).

I expect your syntax is fine, but without knowing the type of transform, it
leaves me guessing about *other* things.  We need to know whether arr1-3
and block1-3 are real or complex, and if complex, whether they're declared
as doubles or some other type.  If doubles, two indices would go to each
output bin.


Michael

0
Reply Michael 8/18/2010 2:22:06 PM

16 Replies
505 Views

(page loaded in 0.269 seconds)

Similiar Articles:


















7/26/2012 12:30:16 PM


Reply: