Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!p19g2000vbq.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: FFT -- sum( v(t)) /= sum (v(t))
Date: Wed, 4 Nov 2009 17:12:09 -0800 (PST)
Organization: http://groups.google.com
Lines: 42
Message-ID: <a263eb2d-3cd4-4c22-b3a4-278d573b025c@p19g2000vbq.googlegroups.com>
References: <hcnqim$l20$1@fred.mathworks.com>
NNTP-Posting-Host: 69.141.163.135
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1257383529 8086 127.0.0.1 (5 Nov 2009 01:12:09 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 5 Nov 2009 01:12:09 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p19g2000vbq.googlegroups.com; posting-host=69.141.163.135; 
	posting-account=mUealwkAAACvQrLWvunjg50tRAnsNtJR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
	2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:582578


On Nov 2, 6:39 pm, "Travis Bland" <travisblan...@yahoo.com> wrote:
> Hi,
>  I'm taking a course using Matlab, and i'm also doing data analysis for a job. Since i started using Matlab, i thought it might be easier to use than my program written in C++, and i was hoping to check the numbers against eachother.
> I have a file data.dat with two columns, time and voltage. The sum  v(t)^2  should equal the sum of v(f)^2, correct? I should have the same total power in the frequency domain as the time domain?
> Well i can't get this to prove true. Here's what i tried
>
> volt_t = data(:,2)
>
> sum ( v(f)^2 )  --------->>> sum(   (fft(volt_t))  .* (fft(volt_t))   )
>
> ans = 7.6598
>
> sum(  ( v(f)/ N )^2) ,where N = length volt_t-------->>> sum(  abs( (fft(volt_t) / N)  .* (fft(volt_t) / N) ))
>
> ans = 8.6741e-08
>
> sum ( (v(t))^2)----------->>> sum(volt_t .* volt_t)
>
> ans = 0.0035
>
> I notice when i read in the file to volt_t, the precision isn't very high. My values are #*e-06 , and matlab gives   0.0001 or 0.0000. Could this be my issue; if so, how do i fix it? If not, any suggestions on what to do?
>
>  Thanks,
>  Travis

Take a look at

http://groups.google.com/group/comp.soft-sys.matlab/msg/2222327db2ea7f51?hl=en

Hope this helps.

Greg