Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Questions about matlab FFT
Date: Thu, 22 Oct 2009 18:16:21 +0000 (UTC)
Organization: Teles AG
Lines: 29
Message-ID: <hbq7hl$c34$1@fred.mathworks.com>
References: <4ae09934$0$831$4fafbaef@reader5.news.tin.it>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256235381 12388 172.30.248.37 (22 Oct 2009 18:16:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 22 Oct 2009 18:16:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1095707
Xref: news.mathworks.com comp.soft-sys.matlab:579410


Ettos <matmailRIMUOVIQUESTO@europe.com> wrote in message <4ae09934$0$831$4fafbaef@reader5.news.tin.it>...
> Hi all,
> I'm new to matlab FFT algorithm, I'm doing some tests with a simple sine 
> function. I've got two questions: one about amplitude and the other 
> about phase.
> The code is this:
> 
> wave = sin(linspace(0,2*pi,100));
> fs = 10000; % Sampling frequency
> n = length(wave);
> Y = fft(wave);
> A = 2*abs(Y)/n; % Amplitude spectrum
> phase = angle(Y)*180/pi;
> 
> 1) Why am I getting amplitude A(2) = 1 only if I multiply abs(Y) by 2?
> 
> 2) Why am I getting phase(2) = -90 and not zero?
> 
> Thank you very much!
> Matteo.

hint: fft returns a complex spec. ie one single-freq-signal --> two peaks
solution: just normalize by (n/2)

but:

sin(linspace(0,2*pi,100)) ???

what happened to your fs?