1
$\begingroup$

time signal FFT outpu

  1. I am getting data from a sensor which gives 64 samples per second. If I take 64 as the sampling frequency, what would be the frequency of the signal?

  2. I have applied a Fourier transform on the signal. I got a double sided spectrum with X-axis ranges from 0-64, if I take a positive side of the spectrum I want to determine the frequency of those points.

    • Image1: plot of samples for 1 sec
    • Image2: FFT of 1 sec signal
$\endgroup$
  • $\begingroup$ Maybe it would help if you uploaded an image of the FFT you are getting. By the way, how do you know that the signal is periodic and it has "a frequency" if you only have some samples of it? $\endgroup$ – Tendero Oct 19 '16 at 3:44
  • $\begingroup$ From what I understand, you are expecting your sensor to read a periodic wave (which is definitely not periodic strictly speaking). But I suppose that the wave is periodic, even though the sensor is making it look weird. So you want to know the frequency of that periodic signal. That would correspond to the highest peak in the FFT graph (approx. 6 Hz), which makes sense with the signal in the time domain (the period seems to be approx. 10.5 samples, which is $10.5/64=0.164$ seconds, which corresponds to a frequency of approximately 6 Hz). $\endgroup$ – Tendero Oct 19 '16 at 4:37
  • $\begingroup$ your signal has a DC component, so you should avoid mapping first few frequency bins to your required frequency/waveform. you can improve your frequency estimation by analyzing larger chunk(more points) of signal in frequency domain. $\endgroup$ – arpit jain Oct 19 '16 at 5:18
  • $\begingroup$ Thanks for the reply, @Tenero: Since we are taking only positive side of the spectrum, do we need to scale it down by half I mean 0- 32 and then the frequency is marked as 3 Hz for the peak power $\endgroup$ – Srinivasan Krishnan Oct 19 '16 at 7:13
  • $\begingroup$ @Srinivasan Krishnan Please double-check what you're doing by "scaling down by half"! You don't just divide the frequencies by 2 to get the "positive" part of the spectrum. $\endgroup$ – AndrejaKo Oct 19 '16 at 12:16
1
$\begingroup$
  • Question 1: the sampling frequency would be $64$ Hertz
  • Question 2: the frequency indices range from $0$ to $63$

In the following code, I tried to mimic your data. At each run, a different observation is produced, based on a sine with a different amplitude distortion and offset.

Using the FFTR.m code that displays one half of the spectrum for real signals, and removing the average, you can get the following figure:

Signal and Spectrum

% Simulated data to mimic your signal
timeSamp = 1/64;
nSample = 64;
xAxis = linspace(0,1,nSample)';
dataClean = sin(2*pi*xAxis*6);
distAmpl = 1/10*( medfilt1(rand(nSample,1),3)+0.15);
dataDist = data.*distAmpl + 0.01*(rand+10);

% Half-axis FFT for a real signal
 [fftR,fftAxe] = FFTR(dataDist-mean(dataDist),timeSamp);

% Display
subplot(2,1,1)
plot(xAxis,dataDist,'.-');grid on;axis tight
xlabel('Time');ylabel('Amplitude');
subplot(2,1,2)
plot(fftAxe,fftR,'.-');
xlabel('Frequency');ylabel('Amplitude');
axis tight;;grid on
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.