Fourier Transform - position to velocity derivative
Afficher commentaires plus anciens
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)
Réponse acceptée
Plus de réponses (1)
Sunny Math
le 12 Jan 2016
0 votes
6 commentaires
Mona Mahboob Kanafi
le 12 Jan 2016
Hello, I have updated my answer. Hope it helps you.
Sunny Math
le 13 Jan 2016
Mona Mahboob Kanafi
le 13 Jan 2016
Using diff function for your problem is correct and common. As you mentioned, ODE is for ordinary differential EQUATIONs and your problem is just a simple differentiation. Since in matlab there is no direct differentiation, using diff is the option here.
Sunny Math
le 13 Jan 2016
Mona Mahboob Kanafi
le 14 Jan 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.
Sunny Math
le 15 Jan 2016
Catégories
En savoir plus sur Bartlett dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!