Fourier transform code issues obtaining frequency domain

1 view (last 30 days)
Hello, I am currently trying to run some code to obtain the frequency domain for the vibrations of a cantilever beam using experimental data. The data has been uploaded correctly etc as I have obtained and plotted the time domain so the problem seems to be with the fourier code as I obtain no data running this code, could someone please tell me where I am going wrong? Also attached is the text file with the experimental data.
% a programme for calculating the frequency domain representation of a time domain signal
data = input ('beamwithoutmassdata'); %read the time domain data into the programme
Fs = input ('500'); %read the sample frequency
nfft = input ('2^16');
X=fft(data,nfft); % perform a fast fourier transform on the array data
X=X(1:nfft/2); % The FFT is symetrical so lose the second half
mx=abs(X); % take the absolute value of X
f=(0:nfft/2-1)*(Fs/nfft);
plot(f,mx)

Answers (1)

Abhishek Ballaney
Abhishek Ballaney on 14 Mar 2018
https://in.mathworks.com/help/matlab/ref/fft.html

Community Treasure Hunt

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

Start Hunting!