FFT in Matlab issue

Discussion in 'Programmer's Corner' started by lodgi, Apr 4, 2013.

  1. lodgi

    Thread Starter New Member

    Oct 16, 2012
    1
    0
    Hi all. Used the site for a while to browse topics but this is my first post.

    I'm doing a MatLab project analysing the frequency components of various data sets of signals from a SimuLink electrical generator that I have created. The data has been collated using the 'sink' blocks in SimuLink. It has been calulated with a 0.0005 timestep.

    Each data set is 24001 long and is of type 'double'.

    This is what ive tried, but I seem to be having problems.

    Fs=2000;
    T=1/Fs;
    N=24001;
    t=(0:N-1)*T;
    NFFT=2^nextpow2(N);
    f=Fs/2*linspace(0,1,NFFT/2+1);
    TESS=fft(Tess,NFFT)/N;
    plot(f,2*abs(TESS(1:NFFT/2+1)))

    The problem is the magnitudes of frequencies are slightly less than the values I would expect. I was thinking this may be a common mistake and I was wondering if anyone could shed any light on why this is?

    Any advice would be appreciated.

    Lodgi
     
  2. JonnyP

    New Member

    Mar 6, 2013
    4
    0
    I think that you could try to create a sin wave that you are sure about the amplitude and use this script. At a first glance the script is the same that I normally use.
     
Loading...