Path: news.mathworks.com!not-for-mail
From: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
Newsgroups: comp.soft-sys.matlab
Subject: Need help with Fourier transform
Date: Wed, 2 Sep 2009 14:46:04 +0000 (UTC)
Organization: Ricardo UK Ltd
Lines: 42
Message-ID: <h7m0fc$kk9$1@fred.mathworks.com>
Reply-To: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1251902764 21129 172.30.248.38 (2 Sep 2009 14:46:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 2 Sep 2009 14:46:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 43398
Xref: news.mathworks.com comp.soft-sys.matlab:567858


<holding head in shame>

If I want to track single frequencies, I can write code like this:

%%%%%%%%%%%%%%%%%code%%%%%%%%%%%%%%

%Time 
t=10*(0:32767)'/32768;

% Pass??
n=(1:length(t))';
n=[n n];

% My signal - pure real at 10, a mix at 5
x=3*cos(10*2*pi*t)+7*sin(5*2*pi*t+0.2);

% Dig out the 5 and plot it
re=cos(5*2*pi.*t).*x;
im=sin(5*2*pi.*t).*x;
[sum(re) sum(im)]/length(t)*2

mag=cumsum([re im])./n*2;

subplot(211)
plot(t,mag)

% Dig out the 10 and plot it
re=cos(10*2*pi.*t).*x;
im=sin(10*2*pi.*t).*x;
[sum(re) sum(im)]/length(t)*2

mag=cumsum([re im])./n*2;

subplot(212)
plot(t,mag)

%%%%%%%%%%%%%%%%%code%%%%%%%%%%%%%%


So I can recover the amplitudes of the real and imag components in my fake signal with the summations.  But what about the wiggles in the plots?

</holding head in shame>