How to extract correct FFT?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello all,
I thank you guys all in advance for your help!
I am currently trying to plot an FFT plot of the strain gauge data I collected from the oscilloscope, and currently have a routine as defined below:
clear all; close all; clc
t = load('T0011.CSV');
time=t(1:125000,1);
gage=t(1:125000,2); % load files and assign to variables
totaltime=1; % total time captured by scope
figure(1)
plot(time,gage);
xlabel('time(s)')
ylabel('signal(volts)')
title('{\bf MTS data}')
legend('gage');
%
%compute frequency
%
fs=length(gage)/(gage(length(time))+abs(time(1)))
m=length(t);
n=m;
% n=pow2(nextpow2(m));
y=fft(gage)/n;
f=(0:n-1)*(fs/n);
figure(2)
semilogx(f(1:n/2),abs(y(1:n/2)));
title('Frequency (Logarithmic x-axis, Linear y-axis)','fontsize',14)
xlabel('Frequency (Hz)')
ylabel('|y(f)|')
legend('gage1');
Alright, the code below gives the bottom two figures: Signal Data http://imageshack.us/photo/my-images/109/fftb.jpg/ FFT Data http://imageshack.us/photo/my-images/833/fft2.jpg/ If you take a look, the first mode natural frequency is around 200 Hz, which is clearly not correct- going through the peak analysis reveals that the dominant frequency is around 40Hz.
I have noticed that even though the function FFT has been developed and made available, going through the different programming causes different frequency plots to come up (with different values), and wanted to make sure that my approach is correct.
Any help and/or advice will be greatly appreciated!
Sam
댓글 수: 0
채택된 답변
Dr. Seis
2012년 4월 23일
Just to eliminate a few things, try this:
dt = time(2)-time(1);
Fs = 1/dt;
M = length(gage);
N = pow2(nextpow2(M));
Nyquist = Fs/2;
df = Fs/N;
f = fftshift(-Nyquist:df:Nyquist-df);
Y = fft(gage)*dt; % I would use dt or 1/Fs for normalization
댓글 수: 2
Dr. Seis
2012년 4월 23일
I can't imagine why that would be... I would think that simply replacing "semilogx" with "plot" wouldn't cause weird behavior. Can you upload another jpg onto imageshack?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!