Fourier Transform - position to velocity derivative
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sunny Math
il 10 Gen 2016
Commentato: Sunny Math
il 15 Gen 2016
Hi everybody,
I am trying to do position to velocity differentiation of discrete points along X-axis and carry out the frequency response of the signal by FFT.
Can someone please help me understand how to take the frequency axis in final plot?.. Can we do this by using ODE45 or by writing a function??.. Thank you
x=9000; % the number of data points along a-axis(position based)
t = 0:0.0015:300; %(0.0015 = sampling cycle in seconds)
dx = diff(x);
dt = diff(t);
dxdt = dx./dt;
fft_dxdt = fft(dxdt); % DFT
fft_dxdt_magnitude = abs(fft_dxdt);
figure()
plot(fft_dxdt_magnitude)
0 Commenti
Risposta accettata
Mona Mahboob Kanafi
il 12 Gen 2016
Modificato: Mona Mahboob Kanafi
il 12 Gen 2016
Hello,
Your problem when assigning frequencies to fft results is only related to the shift of frequencies. The frequencies which you have assigned are corresponded to the results of matlab fftshift (fft after being centered in zero). Therefore you have to apply fftshift to your fft results as below:
T = 0.0017; %Time increment(in second)
t = (0 : T : (16.15-T))'; % 9500 samples
fs = 1/T; %Sample rate in Hertz
N = length(t); % Number of samples
TotalTime = T * N;
df = fs/N; %Frequency increment
% df = 1/ TotalTime;
f = -fs/2: df: fs/2-df; % shifted frequencies corresponding to matlab fftshift
FFT_V_x = fft(V_x); %Fourier Transform
FFT_V_x_magnitude = abs(fftshift(FFT_V_x)); %Absolute Values
plot(f ,FFT_V_x_magnitude)
If you don't get my explanation, I again suggest you to read this link for further explanation:
And about your doubt on sampling frequency, since you haven't resample your data, your sampling frequency and therefore assigned frequecies will not change. If you later have problem that the assigned frequencies have higher number of samples than your Vx and Ax vectors, try extrapolating your velocity and acceleration, or simply add zero at the beginning and end to make them fit in size (this does not change the dominant frequency components).
Hope these helps,
-Mona
Più risposte (1)
Sunny Math
il 12 Gen 2016
6 Commenti
Mona Mahboob Kanafi
il 14 Gen 2016
Hello,
I couldn't download your code, but your velocity PSD looks quite normal. I think what you want to see is in logarithmic scale which you must use:
loglog(f,FFT_V_x_magnitude)
This must solve the problem, but if you still can't get what you want, you must start applying window function (bartlett, tukey,Welch,...) to your signal before applying fft like this, since your signal is not periodic for fft:
V_x = V_x .* bartlett(length(V_x))';
Also, I assumed that you know what that high peak in zero frequency means. It is just related to the mean value of your signal and you can remove signal mean value to be zero before applying fft, or otherwise you can just ignore that high peak. Hope these help you.
Vedere anche
Categorie
Scopri di più su Bartlett in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!