# What is the right way to extract particular frequency phase information from FFT?

Signals acquisition:

Two proximity sensors are positioned Orthogonal to each other. These would be measuring the vibrations of a rotating shaft.

Problem:

Each of these 2 signals has two dominant frequency components (2441 Hz & 762.9 Hz ) in it. I don't know the phase and amplitude information. I'm interested in finding the phase of the signal at 2441 Hz and 762.9 Hz. I did the following process to achieve amplitudes and phases in MATLAB

1. Applying FFT to the raw signal and calculating Amplitude and Phase.

%fft for X signal
fftx=fft(X,NFFT);
% absolute value of the signal
Xn = abs(fftx);
A = mean(Xn);  % I took the mean to get single value.
phase = unwrap(angle(fftx));
phase_mean = mean(alpha);

2. Filtering raw signal to specific frequency prior to applying FFT using Butterworth filter. ( In this example I filtered to 2441 Hz)

[b,a] = butter(2, [ 2440/(fs/2),2441/(fs/2)],'bandpass');
X_filtered = filter(b,a,X);
% Applying FFT to filtered signal
fft_filtered = fft( X_filtered,NFFT);
Xn_filtered = abs(fft_filtered);
A_filtered = mean(Xn_filtered);
phase_filtered = unwrap(angle(fft_filtered));
phase_filtered_mean = mean(phase_filtered);

3. I did the same process as point 2 to filter to another frequency say 762.9 Hz.

4. My sampling frequency and other things are defined as follows.

L = length(X); % 50050 is length of signal
NFFT = 2^nextpow2(length(X)); % Zero padding to nearest N power 2
%Define frequency axis
fs = 1e7; % Sampling frequency
df = fs/NFFT; % frequency resolution
dt = 1/df; % time resolution
X_detrend = detrend(X,0); % Removing DC Offset


I've been reading a lot of other posts on the FFT phase and Amplitude.But I'm confused with most of them. In my case, I need to extract frequency particular information (amplitude and phase) to do further calculation. I'm still unsure if using the filters is right way? Will FFT and filters alter the signal information in any way? Could someone enlighten in understanding the efficient way to extract amplitude and phase information from a signal of particular frequency component.

• You need to specify a reference point (or sample or time) for phase, especially since your signals are not integer period in aperture. – hotpaw2 May 5 '15 at 18:22
• @hotpaw2 I'm interested in measuring the phase angle with reference to the sensor axis which is collecting the signal. In fact there are 2 sensors, which are orthogonal positioned. These 2 sensors would be measuring the vibrations of a shaft. Also, correct me if I'm wrong.... Won't the FFT phase yield the phase of the signal with respect to the signal measuring sensor axis? – Agni May 6 '15 at 5:51
• An FFT references phase to a point within the full (padded) vector of NFFT sample. So unless the samples can be referenced to shaft position or angle with respect to the sensor, the FFT phase result will have nothing to do with sensor axis. – hotpaw2 May 6 '15 at 6:49
• Assuming the samples are referenced to the shaft position. Up to what extent are the FFT phases meaningful? ( with out taking mean). – Agni May 6 '15 at 6:58
• Also, I ensured that the raw signal length is exactly equal to NFFT to further eliminate zero padding to the original signal. – Agni May 6 '15 at 7:00

You don't specify the sampling rate, but I'll assume it's high enough. With only two frequencies, your best bet is to define your DFT frame on a whole number multiple, of one, possibly both. In this case the ratio of frequencies is about 3.2, which is a ratio of 16 to 5. So if you select a DFT length with 10 of the lower frequency's wavelengths, and 32 of the higher frequencies, or some greater multiplesv when you take the DFT, the frequencies should be adequately centered on their respective bins. Then you can get a good read on the phase and amplitude directly from their respective bin values. They should be far enough apart that leakage or harmonics will not significantly interfere with your results.

In case with a real signal, where the frequency is known and not bin centered, the phase and amplitude can be calculated by a method I describe in my blog article "Phase and Amplitude Calculation for a Pure Real Tone in a DFT: Method 1".

You can also reduce the impact of noise by using the average method of my blog article "Exponential Smoothing with a Wrinkle" which will smooth your signal without shifting the phase values. The amplitude will be attenuated but the article gives a formula for recovering the original amplitude from the smoothed one.

Hope this helps.

Ced

To estimate spectral component phase angle relative to shaft angle using an FFT of length N, first gather a sequence of N samples such that the shaft angle is known with accuracy at sample number N/2, then window with a Nuttal window and do an FFT shift before the FFT. The atan2() of the FFT bin result closest to the desired spectral component will produce an estimate of the phase relative to the center of the original sample window. Adjust that phase by the known shaft angle at that N/2 sample point to get a spectral phase relative to shaft angle.

If you know the spectral frequency or use a frequency peak estimator, then the phase can also be interpolated between bins for increases phase estimation accuracy. Interpolate phase by using a Sinc interpolation seperately on the real (even) and imaginary (odd) FFT result components before taking the arctangent.

• What do you mean by spectral frequency? Is that the particular frequency (in my case 2441Hz). Correct me if I'm wrong. I would pick the bins where I've the frequency of interest and interpolate the phase using sinc? – Agni May 7 '15 at 13:59