Wrong DFT results: what should I correct in my code?

1 view (last 30 days)
Greetings,
I am trying to apply the DFT code to the data acquired from Abaqus which is as follows:
[data,txt,raw]=xlsread ('R0-1','triangular'); % Read excel data from file R0-1 and sheet triangular
Time=data(:,1); % Read time values from the first column
Ts=mean (diff(time)); % Sampling time period
Fs=1/Ts; % Rate of sampling
y=fft(data(:,2)); % Applying fft to stress (second column)
L=length(data (:,1)); % Returning longest dimension. I just got it off somewhere from matlab forums whilst searching for it, i dont know the exact meaning behind it.
n=0 : L-1; % Read all arraways from 0 to L-1
freq=n.Fs/(L-1); % Don't know the meaning behind it again but was found somewhere on matlab forums.
Plot(freq, abs(y)),xlabel('Frequency (Hz)'), ylabel ('Stress (Pa)'); % Plot frequency against var (variable)
One thing you might observe in the Excel file attatched is that the maximum amplitude of the stress wave is "102868", however when the code is run i get the following:
The stress value shown in the plot is too high and so it doesn't make sense when I look at excel values! And it doesn't correspond the amplitude in the excel file. As for the frequency, I have no assurance of it being correct either.
I am using matlab as a part of my project of stress wave propagation analysis and so dft is a minor part of my results.
My objective is simple: get Fourier transform using fft (or dft) by performing the operation of time against stress excel data for the wave propagation of a bar fixed to one end.
Your guidance and help would be welcomed.

Answers (0)

Community Treasure Hunt

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

Start Hunting!