Clear Filters
Clear Filters

Fourier transform, Position to Jerk differentiation

4 views (last 30 days)
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 = (9500x1 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.

Accepted Answer

Rick Rosson
Rick Rosson on 21 Feb 2016
fftshift does not compute the Fourier Transform. You need to use the fft function in conjunction with fftshift, as:
V = fftshift(fft(v));
Rick Rosson
Rick Rosson on 22 Feb 2016
Edited: Rick Rosson on 22 Feb 2016
There is no such thing as dt2 or dt3. Just use dt for all derivatives. And there is no need to compute the vector of dt, it is simply a constant:
dt = T = 1/fs
Velocity is not the derivative of position divided by the derivative of time. It is instead the derivative of position with respect to time. It makes no sense to talk about the derivative of one variable without specifying with respect to which variable it is taken. Remember:
v = dx/dt
which is not the same thing as
x' / t'
which is meaningless.
Sunny Math
Sunny Math on 22 Feb 2016
Edited: Sunny Math on 22 Feb 2016
If I want to find derivative of position based on some values along X axis and sampling time 0.15sec, how to find derivative in terms of velocity ,acceleration?...
v = dx./dt; (is this the correct one?)
how to carry out differentiation with Respect to Particular Variable time t?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!