first I need to mention I'm new to signal processing. here is the situation: I have an acceleration time-series derived from an accelerometer
I wanted to imply a filtering method like high pass filter to denoise the signal. Using Fast Fourier Transform, I need first to decite on Cutoff frequency value. After looking at fft(acc) I thought the cutoff frequency should be 5hz I must note for x-axis (frequency) I just invert time (Fr=1/t) hope it's correct.
the estimated FFT's values are complex (not real numbers) which I force to work on the real part not imaginary. here is the code I used to filter acceleration signal noise by fft-highpass filter:
% Matlab_code % Filtering signals by fft-HighPass %% acc=xlsread('accel_signals.xlsx',1,'B2:B4036'); t=xlsread('accel_signals.xlsx',1,'A2:A4036'); figure(1) plot(t,acc,'b') xlabel('Time(s)');ylabel('Acceleration (m/s^2)'); hold on %% Ts=mean(diff(t)); % Sampling rate Fs=1/Ts; % Sampling Frequency Fc=5; % Cutoff frequency = 5 hertz fft_aac=real(fft(acc)); signal_temp=[acc,1./t]; signal=signal_temp; for i=1:length(signal_temp) if signal_temp(i,2)<5 signal(i,1)=0; else signal(i,1)=signal_temp(i,1); end end filtered_acc=real(ifft(signal(:,1))); plot(t,filtered_acc,'r') %
Now the graph below is the result. the blue line is the noisy one and the red line is filtered signal. the filtered acceleration signals aren't even in the range of acceleration data but it's simply a noisy straight line.
here I listed my questions: 1- why is that happening? filtering didn't work well! 2- Do I need to use Hi pass or low pass filter by the way 3- What is the right way to choose cutoff frequency
please also help me with commenting on code and the way I approached filtering signal noise.
And after having a good filtering do I need to use a numerical integration (like trapezoidal integration method) to measure the instantaneous velocity and position? Thanks in advance