Instantaneous velocity and displacement from acceleration signal using a proper filtering method 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)&lt;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
There a a number of conceptual problems with you code.  The first has to do with filtering by zeroing out FFT bins.  This is covered in:

Why is it a bad idea to filter by zeroing out FFT bins?

The second has to do with just taking the real part of the fft.  I don't understand why you did this but this is the wrong way to do the wrong thing.  

If your near term priority is to process your data.  I suggest you discard most of your code and take an entirely different approach with using the built in Matlab timeseries class and use one of the built in filter methods on the object you create. The plot methods are also easy to use and you can set units on the object you create.  This is the most direct way to a "correct" result with your data. 

If you want to understand how to write your own correct code, this will take more time.  There is more than one way to filter data and choosing which takes some time to learn.  You can look at:

What resources are recommended for an introduction to DSP?

Essentially, I'm pointing you at a number of books that are several hundreds of pages of study, which is the long term answer to your problem. You will know what is correct.  

If you do some Googling, you can probably find something in the middle that suits your needs but I can't recommend anything because I don't know what you know and don't know. 

If you may permit the analogy, If one sees someone drowning, do you throw them a floatation device or try to teach them to swim.  

Someone else here may provide a suitable solution. 

It is to your credit that you have shown genuine effort.