Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!news.mixmin.net!news.newsland.it!feeder.news.tin.it!spool.news.tin.it!not-for-mail
Date: Thu, 22 Oct 2009 19:41:07 +0200
From: Ettos <matmailRIMUOVIQUESTO@europe.com>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Questions about matlab FFT
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 19
Message-ID: <4ae09934$0$831$4fafbaef@reader5.news.tin.it>
Organization: TIN.IT (http://www.tin.it)
X-Comments: Please send technical notifications to newsmaster@tin.it
NNTP-Posting-Host: 79.22.126.151
X-Trace: 1256233269 reader5.news.tin.it 831 79.22.126.151:15062
X-Complaints-To: Please send abuse reports to abuse@retail.telecomitalia.it
Xref: news.mathworks.com comp.soft-sys.matlab:579396


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.