From: zhiliang liu on 12 Jan 2010 15:10 I typed the following codes, but why were the results i got not equal? >> t=[1:100]; >> x=sin(t); >> x_fft=fft(x); >> x_sum=sum(x.^2) x_sum = 50.2684 >> x_fft_sum=sum(abs(x_fft).^2) x_fft_sum = 5.0268e+003
From: Wayne King on 12 Jan 2010 15:31 "zhiliang liu" <uestclzl(a)163.com> wrote in message <hiikve$mb9$1(a)fred.mathworks.com>... > I typed the following codes, but why were the results i got not equal? > > >> t=[1:100]; > >> x=sin(t); > >> x_fft=fft(x); > >> x_sum=sum(x.^2) > > x_sum = > > 50.2684 > > >> x_fft_sum=sum(abs(x_fft).^2) > > x_fft_sum = > > 5.0268e+003 Hi, because the way that the DFT is implemented in Matlab, the transform is not a unitary operator. Note the squared l2 norms differ by a factor of 1/N (in your case N=100). Compare: 1/sqrt(100)*norm(x_fft) and norm(x) Hope that helps, Wayne
From: TideMan on 12 Jan 2010 15:33 On Jan 13, 9:10 am, "zhiliang liu" <uestc...(a)163.com> wrote: > I typed the following codes, but why were the results i got not equal? > > >> t=[1:100]; > >> x=sin(t); > >> x_fft=fft(x); > >> x_sum=sum(x.^2) > > x_sum = > > 50.2684 > > >> x_fft_sum=sum(abs(x_fft).^2) > > x_fft_sum = > > 5.0268e+003 Well, there is a hundred-fold difference between these results, and you have exactly 100 data. Do you think there may be some correlation here? Try the same thing with t=[1:200]; and see what happens.
From: zhiliang liu on 12 Jan 2010 17:02 TideMan <mulgor(a)gmail.com> wrote in message <320c9cc3-b21a-4c3b-b64f-65d202d7e244(a)26g2000yqo.googlegroups.com>... > On Jan 13, 9:10 am, "zhiliang liu" <uestc...(a)163.com> wrote: > > I typed the following codes, but why were the results i got not equal? > > > > >> t=[1:100]; > > >> x=sin(t); > > >> x_fft=fft(x); > > >> x_sum=sum(x.^2) > > > > x_sum = > > > > 50.2684 > > > > >> x_fft_sum=sum(abs(x_fft).^2) > > > > x_fft_sum = > > > > 5.0268e+003 > > Well, there is a hundred-fold difference between these results, and > you have exactly 100 data. Do you think there may be some correlation > here? > Try the same thing with t=[1:200]; and see what happens. Yes, I see. The x_fft_sum is equal to x_sum times the length of data (100 in the above code). But would you like to explain further how to explain the relationship.
From: Wayne King on 12 Jan 2010 17:13
"zhiliang liu" <uestclzl(a)163.com> wrote in message <hiirgt$rgu$1(a)fred.mathworks.com>... > TideMan <mulgor(a)gmail.com> wrote in message <320c9cc3-b21a-4c3b-b64f-65d202d7e244(a)26g2000yqo.googlegroups.com>... > > On Jan 13, 9:10 am, "zhiliang liu" <uestc...(a)163.com> wrote: > > > I typed the following codes, but why were the results i got not equal? > > > > > > >> t=[1:100]; > > > >> x=sin(t); > > > >> x_fft=fft(x); > > > >> x_sum=sum(x.^2) > > > > > > x_sum = > > > > > > 50.2684 > > > > > > >> x_fft_sum=sum(abs(x_fft).^2) > > > > > > x_fft_sum = > > > > > > 5.0268e+003 > > > > Well, there is a hundred-fold difference between these results, and > > you have exactly 100 data. Do you think there may be some correlation > > here? > > Try the same thing with t=[1:200]; and see what happens. > > Yes, I see. The x_fft_sum is equal to x_sum times the length of data (100 in the above code). But would you like to explain further how to explain the relationship. Hi, I think that both Tideman and I explained it to you. Look at the Wikipedia article on Parseval's theorem: http://en.wikipedia.org/wiki/Parseval's_theorem and then look for the discrete Fourier transform you will see the squared norm equivalence. Wayne |