Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: FFT of an array
Replies: 0

 sam Posts: 16 Registered: 2/20/13
FFT of an array
Posted: Mar 7, 2013 11:00 AM

Hi

I'm simply trying to plot a FFT of an array.
I can take an FFT and get the correct shape but cannot scale to correct frequencies.
Can anyone please help me? i've tried various methods but i'm not getting very far. My code is as follows:

------------------------------------------------------------------------------
[t, x]=ode45(@vanderpol,0:2*pi/OMEG:1000,[0 1]);

A = size(x);
Fs = (2*pi/OMEG)/1000; %sampling freq - because ODE from t =0:2*pi/OMEG:1000
NFFT = 2^nextpow2(A);
output = fft(x,NFFT)/A;
freq = Fs/2*linspace(0,1,NFFT/2+1);

figure(1)
plot(freq, 2*abs(output(1:NFFT/2+1)))
---------------------------------------------------------------------------------

where t = 90000x1 double, x = 90000x2 double, a = 90000x2 complex double

Anyhelp would be greatly appreciated. I've been going round in circles for ages.