how to use excel data in matlab for fast fourier transform?

16 views (last 30 days)
Hi everybody
i have attached a excel file. In this file, the first column is my magnitute in micron. I have got 71 magnitude values and all recorded in 0.5 seconds.I would like to use FFT, to change from time domain into frequency domain.
Sampling frequency is 142.
Can anyone help me out how to do that?
Kind regards.
  5 Comments
dpb
dpb on 23 Mar 2019
"Clearly, I was doing image processing. for each frame..."
I see nothing in the code that gives any clue whatsoever that that would have been so, certainly not "clearly".
Anyways, it's certainly not clear to me how an image relates to lateral vibration, but looks like you would have to build the data arrays to do the FFT across all the images--whether those are 2D or what isn't clear to me, certainly as you've got simply a vector above.
What is this the "magnitude" of?
engineer
engineer on 23 Mar 2019
I have attached the excel file that I am using, as well the code. I have got a data for lateral and axial vibration as in attached excel file. In my code, I plotted these vibration in time and frequency domain. I am not sure if I used FFT right to plot these vibration in frequency domain. The magnitude of vibration range is not the same in time and frequency domain. what could be the reason? There is a peak at the start of the graph for axial and lateral vibration in frequency domain. Can you please tell me how should interpret the graphs? are my plots correct?

Sign in to comment.

Accepted Answer

dpb
dpb on 23 Mar 2019
[V,H]=xlsread('Vibration_analysis_FFT.xlsx'); % read data
H % headers -- ok, says lateral, axial in first two column
T=mean(diff(V(:,3))) % sample rate.. 0.005 --> 5 ms
Fs=1/T; % sampling frequency, 200 Hz
L=length(V); % length of sample
t=(0:L-1)*T; % time vector -- not really needed
Y=fft(V(:,1:2)); % FFt the two accelerations
P2=abs(Y/L); % 2-sided PSD estimator
P1=P2(1:fix(L/2)+1,:); % 1-sided
P1(2:end-1)=2*P1(2:end-1); % (-)freq half the energy but only only one DC;Fmax bin
f=Fs*(0:fix(L/2))/L; % the frequency at 200 Hz for L points
figure
plot(f,P1)
Shows have mostly just a DC component (non-zero mean) whch, parenthetically, means the sensor must be moving somewhere...let's compensate for the mean and see if helps...don't think will a lot because there's still mostly just a 1/f rolloff, no real spectral content in the signal...untitled.jpg
Y=fft(V(:,1:2)-mean(V(:,1:2))); % remove mean before FFT
P2=abs(Y/L);
P1=P2(1:fix(L/2)+1,:);
figure
plot(f,P1)
untitled.jpg
As thought, just wipes the one commponent out, but leaves most other low frequency stuff. Try just a little more resolution by interpolationg since is very short signal...
N=128;
Y=fft(V(:,1:2)-mean(V(:,1:2)),N); % use 128-pt FFT
P2=abs(Y/L); % all the energy still in L time samples
P1=P2(1:fix(N/2)+1,:);
P1(2:end-1)=2*P1(2:end-1);
f=Fs*(0:fix(N/2))/N;
figure
plot(f,P1)
untitled.jpg
Shows a little more structure, maybe -- whether any of it is real is probably questionable I'd guess...what is the measurement of?
  4 Comments
engineer
engineer on 23 Mar 2019
Thanks for the answer. It is very informative. As I am doing vibrational analysis, I though FFT would help to understand the vibrational behaviour of my object. Instead of having displacements in x and y direction versus time, I thought would be more effective to see displacments versus frequency so that I can see at what amplitude what is the frequency? Therefore I was confused when I saw the amplitude range changed. What I wanna conclude from the graph is that what is the max displacement and at what frequency? Because, I thought even if I calculate the max amplitude in x and y direction, without frequency information, this graph would not be very informative. I hope I am on the right track.
dpb
dpb on 24 Mar 2019
Edited: dpb on 24 Mar 2019
Well, I don't know...without knowing a lot more about what you're measuring and what the objectives are, it's really hard to say anything concrete about the data itself other than "it is what it is".
Basically, it shows there was a translation measured which occurred mostly in one translation between sampling points very early and then another sorta' jerky ramp towards the middle and then one big jump in X at the end that was reversed to its starting point.
There really is very little indication of any real consistent frequency pattern in the motion and what there is looks to be mostly undersampled in that the excursions mostly are only one or two points along those events.
Add on to that, that you have an extremely short time series to work with, what estimation of any frequency components in the signal is pretty difficult to discern could be anything more than noise.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!