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?
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
- 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:
% 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