Just how do those apps which measure your heart rate from your smartphone camera work? Assuming it’s not a scam app, they usually employ a combination of six different methods to increase accuracy.
The Discrete Fourier Transform (DFT) is used to translate the signal from the time domain to the frequency domain. The Fast Fourier Transform (FFT) algorithm was used to save processing time when computing the DFT. While the computational complexity of the DFT is O(N2) for a set of N points, the FFT gets the same results with O(N · log2(N)), which means a huge speed-up when N is high.
There is a special command to compute the FFT in Matlab. The FFT of a real signal is a complex signal in which each complex sample represents the magnitude and the phase of the corresponding frequency. In our case, the phase is not needed. The FFT magnitude is easily computed in Matlab: