problem with frequency domain using fft on raw data

조회 수: 3 (최근 30일)
omar Benamiar Messari
omar Benamiar Messari 2018년 8월 21일
편집: dpb 2018년 8월 22일
I have a problem in my MATLAB program. I'm trying to find a cutoff frequency to create a low pass filter for compass data. I'm trying to go from the time domain to the frequency domain and find an Fc, so I used the FFT but it seems that's it's nor working.
This is what i have done:
if true
fs=1500;
dataset=xlsread('data.xlsx','Feuil1','A1:A363');
t=1:length(dataset);
L=length(dataset);
z=fft(dataset);
P2 = abs(z/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = fs*(0:(L/2))/L;
subplot(2,2,4)
plot(f,P1)
title('frequenciel')
xlabel('f(hz)');
ylabel('p1(f)');
end
but i have found something weird. wish is not what i was expencting
  댓글 수: 3
omar Benamiar Messari
omar Benamiar Messari 2018년 8월 22일
hello, i'm expecting to see a big peak somewere on my frequency axes that i can shoose my fc . i also so that my bandwidth of my sensor is 10 khz which mean that normally i should have a peak on 10 khz. am I wrong ? sorry for my english.
dpb
dpb 2018년 8월 22일
편집: dpb 2018년 8월 22일
You only sampled at 1500 Hz (fs=1500) according to your code so Nyquist frequency is 750 Hz.
The response of the sensor will depend on the frequency of the energy content of the input to it; "bandwidth" only means it is capable of responding up to that frequency (probably with some documented attenuation value) but you would have to sample at least 2X that frequency to see it and actually by 3-4X that to really reproduce the input well owing to Nyquist.
The FFT "knows nuthink!" about what the actual sampling frequency is; it is immaterial to the algorithm; the frequency for analysis/presentation is totally dependent upon what you say your sampling frequency was and there's absolutely no way to determine that from just the sampled data itself.

댓글을 달려면 로그인하십시오.

답변 (1개)

Dimitris Kalogiros
Dimitris Kalogiros 2018년 8월 21일
Instead of
plot(f, P1)
i suggest to use
plot(f, 20*log10(P1));
  댓글 수: 1
omar Benamiar Messari
omar Benamiar Messari 2018년 8월 22일
this is really not what i'm expecting normally i should see a peak on 10000 khz because the bandwidth of the sensor is at 10khz normally using matlab i should see this on the frequency domain.i don't know i'm just confused.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by