how can i apply any function for the discrete signals in matlab?

Discussion in 'MATLAB' started by Fahriddin Mamatov, May 24, 2011.

  1. Hello all
    I have a question about the discrete signals, can someone help to me please?
    I have a raw data which is collected from accelerometer, but i can't apply any function to the raw data. ( ), in here I have already apply my data, you can see plotting with "fft" function.
    Actually, i want to calculate this signals periodicity, so can someone help to me please?
    any help we be appreciated,
    Fahriddin Mamatov, May 24, 2011
    1. Advertisements

  2. Fahriddin Mamatov

    Wayne King Guest

    Hi Faha, I do not believe the link you provide shows us anything. If you want to identify periodicities with fft(), you need to know the frequency at which the data from the accelerometer were sampled. Do you have the Signal Processing Toolbox? If so, use a spectrum object, it is more automatic than fft() if you are unfamiliar with how the DFT works.

    t = linspace(0,1,1e3);
    x = cos(2*pi*60*t)+0.2*randn(size(t));
    % The 'Fs' input is the sampling frequency, here 1 kHz.

    You can zoom in on the above plot to see the periodicity at 60 Hz.

    Using fft:

    xdft = fft(x);
    freq = 0:1e3/length(x):500;
    grid on;

    Note: I have not scaled the above properly to approximate a PSD estimate, but you seem to be only interested in identifying an oscillation, so I think that will suffice.

    Write back with code examples and your sampling frequency if you get stuck.

    Hope that helps,
    Wayne King, May 24, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.