MATLAB: Fourier transform, Position to Jerk differentiation

accelerationdifferentiationfftshiftfourier transformjerkposition;

Hello.. I am learning how to use fft in Matlab. I have X and Y axis values(Position) w.r.t time. I have carried out successively differentiated to velocity and acceleration. I want to find jerk from acceleration. Then I have carried out the Fourier transform by FFFshift Which I found from the article. I have some questions:
1. Why should use FFTshift as the values(position based) are not periodic in nature?. Also the frequency axis should start from 0 to total length.
2. What would be the procedure to carry out fft if I don't opt to use fftshift?
3. What is the dt3 to differentiate from position to jerk? I know dt and dt2.
4. Please check frequency axis for velocity, acceleration and jerk? correct it if its wrong.
Please look at the following code:
>> T = 0.0017; %Sampling Rate in secs
>> t = (0 : 0.0017 : 19.992-T)'; %total time for 9500 samples
>> fs = 1/T; %Samples per second
>> X = (9500×1 double); %Position values along X-axis
>> N = length (t); %length of the samples
>> TotalTime = T * N;
>> df = fs/N; %frequency increment
>> f = (-fs/2: df: fs/2-2*df)'; %frequency axis
>> dX = diff(X); %derivative of samples
>> dt = diff(t); %derivative of time
>> v_x = diff(X)./diff(t); %Velocity
>> fft_v_X = fftshift(v_X); %Fourier Transform
>> FFT_V_x_magnitude = abs(fft_v_x); %absolute values
>> plot(f,FFT_V_x_magnitude)
>> dt2 = (dt(1:end-1)+dt(2:end))/2; %second derivative of time
>> A_x = diff(v_x)./dt2; %Acceleration
>> fft_A_x = fftshift(A_x); % Fourier Transform
>> fft_A_x_magnitude = abs(fft(A_x)); %Absolute Values
>> fa = (-fs/2: df: fs/2-3*df)'; %frequency axis for acceleration
>> plot(fa,fft_A_x_magnitude)
Thank you for help.

Best Answer

fftshift does not compute the Fourier Transform. You need to use the fft function in conjunction with fftshift, as:
V = fftshift(fft(v));
Related Question