필터 지우기
필터 지우기

Help interpreting Fast Fourier Transform.

조회 수: 4 (최근 30일)
Snow
Snow 2023년 6월 28일
이동: Star Strider 2023년 6월 28일
to perform a FFT on data I collected that reperesented voltage vs time. The data can be found here https://mega.nz/file/JX81BI5L#ivW7WgkKpxjhqMBXC2nUYuc8ykC_sXahZuAu1UaMc6w
The code I used is as follows :
t = readmatrix('fftpoop.xlsx');
>> dt = 16.788
dt = 16.7880
>> fs = 1/dt;
>> plot(t(1:16789,2))
>> %time
>> t = t(1:16789,2);
>> t_f = fft(t);
>> m = length(t_f);
>> freq = (-m/2:(m/2-1))*fs/(m-1);
>> plot(freq,fftshift(abs(t_f)))
And i recieved a plot that looks like this :
I manually counted the average time between peaks from the original time data to be .37s. I used this time to calculate the a distance, D = 8.3*10^-7 m/s * .37 s = 307 nm* (2) = 614 nm. This is very close to the value I was expecting (633 nm).
I believe that If I find the frequency from this fft that has the highest peak, then I can use that to use the equation, time = 2pi/freq and verify my time is correct / make my time variable more accurate, and get a better value for D calculated above
I tried using the x value centered at 0 and the next highest peak from the 0 peak in the above graph as my frequency, but they all produce numbers wayyyy bigger from the expected distance.
Am I using this data correctly?

채택된 답변

Star Strider
Star Strider 2023년 6월 28일
이동: Star Strider 2023년 6월 28일
My analysis —
M1 = readmatrix('fftpoop')
M1 = 16789×2
6.7970 -0.3610 6.7980 -0.3620 6.7990 -0.3650 6.8000 -0.3680 6.8010 -0.3680 6.8020 -0.3650 6.8030 -0.3600 6.8040 -0.3590 6.8050 -0.3610 6.8060 -0.3660
t = M1(:,1);
s = M1(:,2);
L = size(M1,1)
L = 16789
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
figure
plot(t, s)
grid
xlabel('Time (s)')
ylabel('Amplitude (V)')
NFFT = 2^nextpow2(L)
NFFT = 32768
FTs = fft((s-mean(s)).*hann(L), NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
[pks,locs] = findpeaks(abs(FTs(Iv))*2, 'MinPeakProminence',0.015);
time = 1/Fv(locs)
time = 0.4201
figure
plot(Fv, abs(FTs(Iv))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Magnitude (V)')
xlim([0 20])
ylim([min(ylim) 0.022])
text(Fv(locs), pks, sprintf('\\leftarrow %.3f Hz\n %.3f V', Fv(locs), pks), 'Horiz','left', 'Vert','top')
I assume your ‘time’ is based on radian frequencies, so I calculated it as the period of the peak frequency in Hz (since my plot is in Hz), giving the period in seconds. I am not certain what the data are or what your analysis requires, so I will defer to you for those.
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by