Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: FFT of an array
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
sam

Posts: 16
Registered: 2/20/13
FFT of an array
Posted: Mar 7, 2013 11:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.