Fourier Transform - position to velocity derivative
Mostrar comentarios más antiguos
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)
Respuesta aceptada
Más respuestas (1)
Sunny Math
el 12 de En. de 2016
0 votos
6 comentarios
Mona Mahboob Kanafi
el 12 de En. de 2016
Hello, I have updated my answer. Hope it helps you.
Sunny Math
el 13 de En. de 2016
Mona Mahboob Kanafi
el 13 de En. de 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
el 13 de En. de 2016
Mona Mahboob Kanafi
el 14 de En. de 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
el 15 de En. de 2016
Categorías
Más información sobre Bartlett en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!