I am fairly new to vibrations and using matalb fft.I am given a set of data (1D array) of length 15000 (not sure if this is relevant) and I am trying to figure out if there is any wave buried in this data at all. I was instructed to possibly use matlab fft. Is that the correct way to do it? what shall I expect to see? I am really not sure how to interpret any results I would get. Please let me know what you all think. Thanks and if more details are needed I will provide them. Example:
% Df=[array is given to me and it is of size 15000];
% t=[time used for the above array, and if it is of the same size, also provided to me]
N_0= length(t);
fs_0=length(Dfxz);
Y_0=fft(Dfxz,N_0);
k_0=-N_0/2:N_0/2-1;
%Find the phase angle
p_0 = (angle(Y_0));
R_0 = norm(Y_0);
ff_0 = (0:length(Y_0)-1)'/length(Y_0)*100; % Frequency vector
FT_power1_0 = abs(Y_0);
plot(k_0*fs_0/N_0,fftshift(abs(Y_0)))
I only see 1 peek at frequency = 0 but I am sure that there are non zero frequencies, what am I doing wrong? Thanks! PS:I am not sure how to pick the sampling frequency either? any tips please (keep in mind that I do not know the original frequency)
Try my version. It looks to me like you have all the information you need to find frequency peaks in your data if they exist. If all you can see is a big peak at zero frequency, you probably have a massive DC offset that is drowning out all your other data. I have put a remedy in my code . .
x = randn(15000,1); %//This is the data you were given - I'll use noise for demonstration - replace x with your Df data
%//If youre getting a massive peak at zero that dwarfs everything else, you
%//probably have a large DC offset. Easily removed in the time domain using
%//the following ..
x = x-mean(x);
tAxis = linspace(3/15000,3,15000); %//You said you have this too - I'll make up something for demonstration - make sure you replace this with your t data
dt = diff(tAxis(1:2)); %//sample period from time axis
fs = 1/dt;%//sample rate from sample period
NFFT = numel(x); %//number of fft bins - change if you like
Y = abs(fft(x, NFFT)).^2; %power spectrum
%//Calculate frequency axis
df = fs/NFFT;
fAxis = 0:df:(fs-df);
%//Plot it all
figure; plot(fAxis(1:NFFT/2), Y(1:NFFT/2))
xlabel('Frequency in Hz')
ylabel('Power')
If that works out OK, you can go into more depth by checking out another FFT answer on stackoverflow.