I have a non-periodic signal collected from a force plate, it represents the foot/ground contact of a human when running.
My aim is to calculate the signal power of each harmonic up to 50Hz. I will break down what I have done so far.
Firstly, I calculate the fundamental frequency by dividing the sampling frequency by the length of the signal. I then find the other harmonics by multiplying the fundamental frequency by 2,3...etc (not shown here, this example just includes the fundamental frequency (FF).
Fs = 1000; FF = Fs/(length(Fz_data));
I run the FFT on my signal.
dt = 1/Fs; t=(0:1/Fs:(length(Fz_data)-1)/Fs)'; NFFT = length(Fz_data); Y = fft(Fz_data,NFFT);
For each harmonic (identified in 1 - FF in this instance),I zero out frequencies above and below the harmonic and then run ifft to convert the data back to the time domain which leaves me with the data for the first harmonic only(?).
F = ((0:1/NFFT:1-1/NFFT)*Fs).'; Y(F<FF-0.1) = 0; Y(F>FF+0.1) = 0; y = ifft(Y,NFFT,'symmetric');
I then calculate the power of this signal using pwelch.
[P,~] = pwelch(y,ones(NFFT,1),0,NFFT,Fs,'power'); pwr = sum(P)
From a programming perspective, this works, but I have reservations that this approach is not based on sound theory. I will, therefore, present some questions below, and I hope the community may be able to offer some solutions to improve the robustness of this approach.
Is it suitable to calculate the fundamental frequency from the length of the signal?
I have read that it is not suitable to use an FFT on a non-periodic signal. Is there a way to adapt the FFT method to make it more suitable e.g. some sort of windowing function?
Is there an easy way to remove drift/bias from the signal?
I would also welcome comments on any other aspects of this process if you feel it would make it more robust.
Thanks in advance.