Forums

FFT and IFFT

Started by Kelvin March 22, 2001
Hi Everyone,
 
    I have a matlab problem which has been bothering me.
 
    I have a vector A of 512 music samples consisting of positive and negative values betw -1 and 1.
    Eg A = 1.0e-004 * [  -0.0946   -0.1547   -0.0371   -0.2034    0.0861   -0.0713    0.0288 0.1651   -0.1140    0.1537 ...........]
 
    I have another vector B, which is a result of A, after undergoing only some minor modifications.
    Eg  B = 1.0e-004 *[  -0.0945   -0.1547   -0.0371   -0.2035    0.0861   -0.0713    0.0289 0.1651   -0.1140    0.1537 ...........]
 
    I found a very strange thing:
 
    Only the 1st to 233th values and 281th to 512th values of fft(A) and fft(B) are almost exactly the same.
    The 234th to 280th values differ by a magnitude of almost 100 to 700!!
   
    My thinking: I thought all the components in fft(A) should rightfully be ALMOST equal to fft(B) since B is almost the same as as A??
 
Can anyone enlighten me please?? Will appreciate any help. Tks!
 
Tks!
 
Rgds
Kelvin



hi,
    Modifying the original data can be expressed as b = a + delta, then we can get:
    fft(b) = fft(a)+fft(delta)
    If the spectrum of delta has high magnitude on some frequency points, i.e.,if your modification is somehow regular, then you will see on these points, fft(b) differ much with fft(a).
 
    I hope this may help.
----- Original Message -----
: Kelvin
: m...@yahoogroups.com ; m...@yahoogroups.com
ʱ 2001323 3:36
: [matlab] FFT and IFFT

Hi Everyone,
 
    I have a matlab problem which has been bothering me.
 
    I have a vector A of 512 music samples consisting of positive and negative values betw -1 and 1.
    Eg A = 1.0e-004 * [  -0.0946   -0.1547   -0.0371   -0.2034    0.0861   -0.0713    0.0288 0.1651   -0.1140    0.1537 ...........]
 
    I have another vector B, which is a result of A, after undergoing only some minor modifications.
    Eg  B = 1.0e-004 *[  -0.0945   -0.1547   -0.0371   -0.2035    0.0861   -0.0713    0.0289 0.1651   -0.1140    0.1537 ...........]
 
    I found a very strange thing:
 
    Only the 1st to 233th values and 281th to 512th values of fft(A) and fft(B) are almost exactly the same.
    The 234th to 280th values differ by a magnitude of almost 100 to 700!!
   
    My thinking: I thought all the components in fft(A) should rightfully be ALMOST equal to fft(B) since B is almost the same as as A??
 
Can anyone enlighten me please?? Will appreciate any help. Tks!
 
Tks!
 
Rgds
Kelvin


_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  m...@yahoogroups.com

To Post:  m...@yahoogroups.com

To Leave: m...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3


">Yahoo! Terms of Service.


The differences FFT(B) and FFT(A) is in "high" frequency components,
that depends on transform of A you performed.
 
You may try with another tool, Excel I suggest.
(Excel, tools, data analysis, Fourier transform.)
 
Best regards
                                                Predrag
 
 

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  m...@yahoogroups.com

To Post:  m...@yahoogroups.com

To Leave: m...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3


">Yahoo! Terms of Service.


Kelvin-

FFT is all about measuring frequency. If you change one value in a time
sequence, you are altering the rate of change between that value and the ones on

either side of it. Slopes and shapes have changed; the time sequence is now no
longer built from the same component frequencies. You've changed the spectrum
of the time sequence; I would be surprised if every FFT value in your result
does not change.

Jeff Brower
DSP sw/hw engineer
Signalogic On Fri, 23 Mar 2001, "Kelvin" <> wrote:
>Hi Everyone,
>
> I have a matlab problem which has been bothering me.
>
> I have a vector A of 512 music samples consisting of positive and negative
values betw -1 and 1.
> Eg A = 1.0e-004 * [ -0.0946 -0.1547 -0.0371 -0.2034 0.0861
-0.0713 0.0288 0.1651 -0.1140 0.1537 ...........]
>
> I have another vector B, which is a result of A, after undergoing only some

minor modifications.
> Eg B = 1.0e-004 *[ -0.0945 -0.1547 -0.0371 -0.2035 0.0861
-0.0713 0.0289 0.1651 -0.1140 0.1537 ...........]
>
> I found a very strange thing:
>
> Only the 1st to 233th values and 281th to 512th values of fft(A) and fft(B)

are almost exactly the same.
> The 234th to 280th values differ by a magnitude of almost 100 to 700!!
>
> My thinking: I thought all the components in fft(A) should rightfully be
ALMOST equal to fft(B) since B is almost the same as as A??
>
>Can anyone enlighten me please?? Will appreciate any help. Tks!
>
>Tks!
>
>Rgds
>Kelvin




Kelvin-

> To illustrate my case, I've attached the values of vector a and b. You
>can see for yourself that they are really ALMOST EQUAL. (In fact, I've taken
>the trouble to check all the 512 samples.)
>
> You will find that fft(a) = fft(b) only at index =1,2 ......233 and 281,
>282, .... 512.
> And fft(a) ~= fft(b) at index = 234, 235, ........280.
>
> I really think there is something wrong as I expect their fft's to be
>also ALMOST EQUAL.

They're fine -- again, MINOR difference in time domain = MAJOR difference in
frequency domain. This is one of the things that makes FFT powerful, don't you
think? Another way to think about it:

-take a flat line of all 1s, do FFT. Result only at dc;
zero value at all frequencies.

-now add one "spike", or glitch to line (i.e.
change only one value to 2, keep others 1).
Result at EVERY frequency.

Why? Because that one spike (or "impulse") contains, by definition, all
possible frequencies. So you can see that even very small change in time domain

makes a big difference in frequency domain.

Also, do not forget that if your input vector is real, then the FFT results are
symmetric about N/2 (in this case 256). So you can ignore 257-512 values.

Jeff Brower
DSP sw/hw engineer
Signalogic >----- Original Message -----
>From: Jeff Brower <>
>To: Kelvin <>
>Cc: <>
>Sent: Friday, March 23, 2001 9:21 AM
>Subject: Re: [matlab] FFT and IFFT >> Kelvin-
>>
>> FFT is all about measuring frequency. If you change one value in a time
>> sequence, you are altering the rate of change between that value and the
>ones on
>> either side of it. Slopes and shapes have changed; the time sequence is
>now no
>> longer built from the same component frequencies. You've changed the
>spectrum
>> of the time sequence; I would be surprised if every FFT value in your
>result
>> does not change.
>>
>> Jeff Brower
>> DSP sw/hw engineer
>> Signalogic
>>
>>
>> On Fri, 23 Mar 2001, "Kelvin" <> wrote:
>> >Hi Everyone,
>> >
>> > I have a matlab problem which has been bothering me.
>> >
>> > I have a vector A of 512 music samples consisting of positive and
>negative
>> values betw -1 and 1.
>> > Eg A = 1.0e-004 * [ -0.0946 -0.1547 -0.0371 -0.2034 0.0861
>> -0.0713 0.0288 0.1651 -0.1140 0.1537 ...........]
>> >
>> > I have another vector B, which is a result of A, after undergoing
>only some
>> minor modifications.
>> > Eg B = 1.0e-004 *[ -0.0945 -0.1547 -0.0371 -0.2035 0.0861
>> -0.0713 0.0289 0.1651 -0.1140 0.1537 ...........]
>> >
>> > I found a very strange thing:
>> >
>> > Only the 1st to 233th values and 281th to 512th values of fft(A) and
>fft(B)
>> are almost exactly the same.
>> > The 234th to 280th values differ by a magnitude of almost 100 to
>700!!
>> >
>> > My thinking: I thought all the components in fft(A) should rightfully
>be
>> ALMOST equal to fft(B) since B is almost the same as as A??
>> >
>> >Can anyone enlighten me please?? Will appreciate any help. Tks!
>> >
>> >Tks!
>> >
>> >Rgds
>> >Kelvin
>>
>
><<Attachment: b.mat>>
><<Attachment: a.mat>>




Kelvin-

> I really appreciate your detailed reply, which helps me a lot in
>understanding the situation more.
>
> However, I wish to ask -- isn't there really any way I can retrieve an
>FFT(b) which is almost the same as FFT(a)??
>
> Reason: The values in vector a is the result of an IFFT(A) at my
>Encoder.
> At the Decoder, due to some reverse process, I was able
>to get values in vector b (which is supposed to be ideally the same as
>vector a, under no distortion. And this is really the case, as illustrated
>in the 2 mat files a.mat and b.mat).
> And when I take BT(b) at the Decoder, I'm supposed to
>have B ideally the same as AT(a). Only then can I decode correctly.
>
> Have you got any advice?

As explained previously, if a and b have any differences, due to numerical
error, loss in your encoder, etc. then FFT results A and B could well be
substantially different. Maybe a and b were supposed to be the same, and your
algorithm did something to one of them?

I'm not sure what you are doing or why. What is the "some reverse process" that

you mention? Is this a reasearch or commercial project? Instead of questioning

why FFT works the way it does, why not explain your project and then someone
might suggest a different or suitable approach that solves the problem?

Jeff Brower
DSP sw/hw engineer
Signalogic >----- Original Message -----
>From: Jeff Brower <>
>To: Kelvin <>
>Cc: <>
>Sent: Saturday, March 24, 2001 4:26 AM
>Subject: Re: [matlab] FFT and IFFT >> Kelvin-
>>
>> > To illustrate my case, I've attached the values of vector a and b.
>You
>> >can see for yourself that they are really ALMOST EQUAL. (In fact, I've
>taken
>> >the trouble to check all the 512 samples.)
>> >
>> > You will find that fft(a) = fft(b) only at index =1,2 ......233 and
>281,
>> >282, .... 512.
>> > And fft(a) ~= fft(b) at index = 234, 235, ........280.
>> >
>> > I really think there is something wrong as I expect their fft's to be
>> >also ALMOST EQUAL.
>>
>> They're fine -- again, MINOR difference in time domain = MAJOR difference
>in
>> frequency domain. This is one of the things that makes FFT powerful,
>don't you
>> think? Another way to think about it:
>>
>> -take a flat line of all 1s, do FFT. Result only at dc;
>> zero value at all frequencies.
>>
>> -now add one "spike", or glitch to line (i.e.
>> change only one value to 2, keep others 1).
>> Result at EVERY frequency.
>>
>> Why? Because that one spike (or "impulse") contains, by definition, all
>> possible frequencies. So you can see that even very small change in time
>domain
>> makes a big difference in frequency domain.
>>
>> Also, do not forget that if your input vector is real, then the FFT
>results are
>> symmetric about N/2 (in this case 256). So you can ignore 257-512 values.
>>
>> Jeff Brower
>> DSP sw/hw engineer
>> Signalogic