I have collected force at the footrest during paddling at two occasions. During one occasion I accidently collected the force signals at 150 Hz instead of 1500 Hz. During the other time the data was collected at 1500 Hz. I now want to calculate the highest frequency of the signal collected at 1500 Hz to be able to know if the data collected at 150 Hz is within the Nyquist criterion. How do I calculate the highest frequency in my signal?

  • $\begingroup$ Can you please modify the question so that it does not appear to be requesting code written to specification? (i.e., "show me how to do [blah] in [some platform]". What you are looking for has nothing to do with MATLAB, it's a DSP concept. $\endgroup$ – A_A Dec 28 '17 at 9:35

In order to determine the spectral content of your signal you can compute and display its Fourier transform. Assuming you have $N$ samples of the signal $x[n]$ sampled at $F_s = 1500$ Hz, then you can simply determine its frequency content by the following Matlab command:

Xk = fft(x ,N);

Then you can plot its spectrum to see if there is significand energy in the frequency region above $150/2 = 75$ Hz by the following code:

figure, plot ( linspace(0,Fs,N) , abs(Xk) ) ;
xlabel('Frequency [Hz]')
title('DFT Spectrum Magnitude |X[k]| of x[n]');

If there is any signifcand energy above $75$ Hz then there will be significand aliasing. However note that the sensor might have applied a $75$ Hz lowpass filter before sampling the signal, so that you can still avoid alising, but your signal will be distorted, nevertheless, as it would have beeen sampled from a lowpass filtered version of the true signal.

  • $\begingroup$ Thank you very much for your answer and code, I did as per you suggestion and also performed a PSD analysis on my 1500 Hz data and both suggest that the energy mostly around are not over 20 Hz so my data should be fine. When I did your code I however got the signals "mirrored" at the beginning and end of the graph. Don't know why? $\endgroup$ – Matilda Dec 29 '17 at 17:08
  • $\begingroup$ Ok glad I could help! Yes they are mirrored about the middle, this is a property of the Fourier transforms; The Fourier transform of a real signal is conjugate symmetric, and this symmetry manifests itself as a mirror in the middle of the DFT analysis of your signal. Btw, I have used an x-scale of 0-Fs to reflect the relation of sampling and signal frequencies. $\endgroup$ – Fat32 Dec 29 '17 at 18:05

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