Time normalization in FFT!

1 view (last 30 days)
Hossein
Hossein on 2 Feb 2016
Commented: Star Strider on 2 Feb 2016
Hi everyone,
I'm trying to take a FFt from a time signal being resulted from an ODE procedure for simulating an imbalance response of a rotor-bearing system in a specific rotational speed. I am a little bit confused after having the fft signal because I can see the pick but not at the right frequency in Herz (theoretically I should see the pick at a frequency equal to rotaional speed of the shaft), I guess something is wrong with time normalization by timesignal but I don't know what exactly:
%
z=Y(:,1); %Timesignal
N=length(z); %Number of samplerates
ts=51/51000; %Sampletime
Fs=1/ts %Samplefrequency
fB = Fs/2;
Yc = fft(z)/N;
YY = 2 * abs( Yc( 1:N/2+1 ) );
YY(1) = YY(1)/2;
f = fB * linspace(0, 1, N/2+1)/0.05882;
Many thanks in advance!
  1 Comment
Daniel Armyr
Daniel Armyr on 2 Feb 2016
I am curious at the number 0.05882. It seems like an oddly specific hard-coded value. Are you sure it is the right value there, and that this is not a number that should be computed from for example ts or Fs?

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 2 Feb 2016
In order to use the fft with your ODE integration, you have to use a vector of fixed values for ‘tspan’, rather than the adaptive times reported by the differential equation solvers. The easiest way to do this is to use the linspace function:
tspan = linspace(t_start, t_end, 500);
This creates a 500-element vector of equally-spaced time values between the values you choose for ‘t_start’ and ‘t_end’.
  2 Comments
Hossein
Hossein on 2 Feb 2016
Hi dude, I've done that, but the question is something else....I don't know how should I nomalize the time scale with respert zu omega (rotational speed of rotor) in my case
Star Strider
Star Strider on 2 Feb 2016
You don’t need to. If you choose enough time points, you will get adequate frequency resolution. I linked to the R2015a documentation on fft in my original Answer, and I’m linking to it here as well. Note specifically the code between the top two plot figures as to how to correctly use the sampling time difference to correctly calculate the frequency vector and plot the fft.
Example code:
s = ... SIGNAL ...
L = length(s); % Length Of Signal
Ts = tspan(2)-tspan(1); % Sampling Time Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FTs = fft(s)*2/L; % Calculate FFT
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector (Hz)
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(FTs(Iv)))
grid

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!